Blits - blitterated/docker-dev-env GitHub Wiki
These don't really belong anywhere. They're mostly just temporary notes. Mostly.
They're called blits because I've moved a chunk of memory around.
docker run -it --rm phusion/baseimage:focal-1.0.0 /sbin/my_init -- bash -l
docker run -it --rm --init debian bash
docker run -it --rm --init ubuntu bash
docker run -it --rm --init --mount type=bind,source="$(pwd)",target=/foo ubuntu bash
docker run -it --rm --init dde bash
Build the image:
docker build -t dde .
Run the image:
docker run -it --rm --init dde /bin/bash
Remove the image:
docker rmi dde
newer way:
docker image prune
older way:
docker rmi $(docker images -qf "dangling=true")
docker builder prune -a
The old export/import trick:
CONT_ID=$(docker create orig_image_name)
docker export $CONT_ID | docker import - lean_image_name
docker rm $CONT_ID
Run the flattened image:
docker run -it --rm lean_image_name /bin/bash
Good explanation of what -it
means
Run a daemonized container and capture it's ID:
CONT_ID=$(docker run -itd --rm ubuntu /bin/bash)
Attach to the container:
docker attach $CONT_ID
Ctrl-d
or typing exit
at the console with shut the container down. Detach again with Ctrl-p
Ctrl-q
.
Execute a command on the container without attaching:
docker exec -d $CONT_ID touch /tmp/foo
Attach and verify the container is still running and that the command above ran:
docker attach $CONT_ID
root@7aaaec656f58:/# ls /tmp
foo
git clone git@ghblit:blitterated/docker_dev_env.wiki.git
Ask Ubuntu: How to list dependent packages (reverse dependencies)?
apt-cache rdepends --installed packagename
apt-cache rdepends --installed packagename | tail --lines=+3 | sort
apt list --installed
-
JetBrains (RubyMine) works directly with Docker
-
Uses Docker Compose
- Docker Compose exec session (tmux)
-
vim has a plugin for Docker
-
Uses tmux for multiple sessions in container.
-
hasn't used byobyu in a while
-
Using docker volumes faster than a bind mount when going from os x to linux fs.
-
NFS was faster than mounts, and he used it before using volumes
-
From an example docker-compose.yml
foo: foo volumes: - .:/foo_app - gems:/gems # The below volumes are helpful to speed up docker on OSX # - node_modules:/foo_app/node_modules # - assets:/foo_app/public/assets # - test_data:/foo_app/public/test_data # - log:/foo_app/log # - tmp:/foo_app/tmp # - npmcache:/foo_app/.npmcache volumes: gems: # the following mounts can speed up docker on OSX # assets: # log: # node_modules: # npmcache: # test_data: # tmp:
-
He does cool stuff with tmux, openrc, sshd, mosh, etc.
-
JAremko/alpine-vim
- Look at user setup in Dockerfile
-
JAremko/drop-in
- Look at setup of sshd in Dockerfile
ENTRYPOINT ["bash", "/usr/local/bin/start.bash"]
-
start.bash
runs/usr/sbin/sshd -De
-
sshd manpage:
-
-D
: sshd will not detach and does not become a daemon -
-e
: Write debug logs to standard error instead of the system log
-
-
sshd manpage:
- It looks like it will run under OpenRC on quick glance, but a closer look shows that it's setup under OpenRC, started, and then stopped only during the image build. Why?
- Look at mounting of ~/.ssh keys in example in README.md
- Look at mounting of /etc/localtime for
tmux
in example in README.md - Has
tmux
, but doesn't appear to run it on container startup.
- Look at setup of sshd in Dockerfile
- Mosh mobile shell
-
-X
Specify HTTP request method -
-d
Sends the specified data in a POST request to the HTTP server
curl -XPOST --unix-socket /var/run/docker.sock "http://localhost/v1.41/images/create?fromImage=nginx:latest"
RES_JSON=$(curl -XPOST --unix-socket /var/run/docker.sock -d '{"Image":"nginx"}' -H 'Content-Type: application/json' "http://localhost/containers/create")
CNT_ID=$(echo $RES_JSON | jq -r .Id)
curl -XPOST --unix-socket /var/run/docker.sock "http://localhost/containers/${CNT_ID}/start"
curl -XPOST --unix-socket /var/run/docker.sock "http://localhost/containers/${CNT_ID}/stop"
curl -XDELETE --unix-socket /var/run/docker.sock "http://localhost/containers/${CNT_ID}"
curl -XDELETE --unix-socket /var/run/docker.sock "http://localhost/images/nginx:latest"
I downloaded all the alpine images b/c there was no tag. Do NOT run this.
#curl -XPOST --unix-socket /var/run/docker.sock "http://localhost/v1.41/images/create?fromImage=alpine"
Deleted them all with this
docker rmi --force $(docker images -f "reference=alpine" -q)
- Investigate JAremko's ideas above.
- Investigate CRIU and critmux.
- Investigae Artix Linux - Arch withoud systemd.
- Investigate Docker Desktop replacements
- Using the Docker API against the Docker socket
- pam_docker