docker run --name bundler -dt -v path/to/real/folder:/docker-folder amazonlinux
This first command starts a Docker container named bundler
with a volume (-v
) that is a bind mount between the real folder at path path/to/real/folder
and the virtual Docker folder at docker-folder
.
It creates the container from the amazonlinux
image.
This also runs the container with the -d
and the -t
flags, which means that the container is running in detached mode (-d
), and also with an attached TTY (-t
), so it will accept commands that you give it.
docker exec -d bundler touch /bind-folder/newFile
This command executes a command on a Docker container in detached mode (-d
). We specify the container to be executed on as bundler
. The command itself is touch /bind-folder/newFile
.
docker stop bundler
Afterward, stop the container since it will indefinitely run in the background otherwise.