January 2017
Intermediate to advanced
284 pages
6h 8m
English
There comes a time in the life of anyone working with containers when you will need to jump into a running container and see what is going on. Fortunately, Docker has just the tool for you in the form of docker exec. The exec subcommand takes two arguments, the name of the container, and the command to run:
$ docker exec -it nginx bash
I slipped an option in there that is important if you are starting an interactive process. The -it option tells Docker that you have an interactive process and that you want a new TTY. This is essential if you want to start a shell:
$ sudo docker exec -it nginx bash root@fd8533fa2eda:/# ps ax PID TTY STAT TIME COMMAND 1 ? Ss 0:00 nginx: master process nginx -g daemon off; 6 ? S 0:00 nginx: ...
Read now
Unlock full access