Search notes:
docker: run and exec
The following
docker run
command creates a
container named
cont-xyz and runs a shell (
/bin/sh
) in it:
$ docker run --name cont-abc --rm -i -t busybox /bin/sh
In another shell on the host,
docker exec
is used to run another shell in the
same container:
$ docker exec -i -t cont-abc /bin/sh
In one of these created shells, a file is created using
touch
:
/ # touch /tmp/touchee
Because the other shell is in the same container, it can see the touched file:
/ # ls -l /tmp/
total 0
-rw-r--r-- 1 root root 0 Jan 13 19:38 touchee