Docker Commit Images

Committing your changes to the container, just like commiting code.

We'll cover the following...

In the last lesson, we got access to the shell of the container and were able to run commands. Since we can use the container like a normal Linux machine, let’s work in it exactly as we work in any normal Linux machine.

If you have exited the container, type docker ps -a and check the first entry or the entry which has bash in its command column.

$ docker ps -a
CONTAINER ID    IMAGE       COMMAND  CREATED      STATUS            PORTS    NAMES
38c22dec7c2a    python:3.5  "bash"   32 seconds ago Exited (0) 6 seconds ago    laughing_grothendieck

Copy the container id and type docker start <container_id>.

$ docker start 38c22dec7c2a
38c22dec7c2a

$ docker ps
CONTAINER ID    IMAGE       COMMAND  CREATED      STATUS            PORTS    NAMES
38c22dec7c2a    python:3.5  "bash"   42 seconds ago Up 2 seconds    laughing_grothendieck

It will start the container, and you can then access the shell using docker exec -it <conatiner_id> bash.

$ docker exec -it
...