Search⌘ K
AI Features

Docker Commit Images

Explore how to work inside a Docker container, make changes like adding a Python script, and then commit those changes to create a new Docker image. Understand the process of saving your container state, pushing images to Docker Hub, and ensuring a consistent environment for sharing and deployment.

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
...