Day 39: Create a Docker Image From Containe

One of the Nautilus developer was working to test new changes on a container. He wants to keep a backup of his changes to the container. A new request has been raised for the DevOps team to create a new image from this container. Below are more details about it:

a. Create an image beta:nautilus on Application Server 2 from a container ubuntu_latest that is running on same server.

I have done the following:

[root@stapp02 steve]# docker images

REPOSITORY   TAG       IMAGE ID       CREATED       SIZE
ubuntu       latest    e0f16e6366fe   4 weeks ago   78.1MB

[root@stapp02 steve]# docker ps -a
CONTAINER ID   IMAGE     COMMAND       CREATED              STATUS    PORTS     NAMES
204c0a478c08   ubuntu    "/bin/bash"   About a minute ago   Created             ubuntu_latest

[root@stapp02 steve]# docker restart ubuntu_latest

Error response from daemon: Cannot restart container ubuntu_latest: failed to create task for container: failed to create shim task: OCI runtime create failed: runc create failed: unable to start container process: error during container init: error mounting "proc" to rootfs at "/proc": mount src=proc, dst=/proc, dstFd=/proc/thread-self/fd/9, flags=0xe: no such file or directory: unknown

[root@stapp02 steve]# docker start ubuntu_latest

Error response from daemon: failed to create task for container: failed to create shim task: OCI runtime create failed: runc create failed: unable to start container process: error during container init: error mounting "proc" to rootfs at "/proc": mount src=proc, dst=/proc, dstFd=/proc/thread-self/fd/9, flags=0xe: no such file or directory: unknown
Error: failed to start containers: ubuntu_latest

[root@stapp02 steve]# docker ps -a
CONTAINER ID   IMAGE     COMMAND       CREATED         STATUS    PORTS     NAMES
204c0a478c08   ubuntu    "/bin/bash"   4 minutes ago   Created             ubuntu_latest

[root@stapp02 steve]# docker commit  ubuntu_latest beta:nautilus
sha256:b5d827867950d78ea2ae54f2d1d40c94e0d43c584aca1cd689400ed0186f28ed

[root@stapp02 steve]# docker images
REPOSITORY   TAG        IMAGE ID       CREATED         SIZE

beta         nautilus   b5d827867950   8 seconds ago   78.1MB

ubuntu       latest     e0f16e6366fe   4 weeks ago     78.1MB


[root@stapp02 steve]# docker ps -a

CONTAINER ID   IMAGE     COMMAND       CREATED         STATUS    PORTS     NAMES
204c0a478c08   ubuntu    "/bin/bash"   6 minutes ago   Created             ubuntu_latest

I am getting the following error

Getting the following error while running docker start and restart command.
Also notice in the output of the docker ps -a command above the status of the container is “created”.

[root@stapp02 steve]# docker start ubuntu_latest
Error response from daemon: failed to create task for container: failed to create shim task: OCI runtime create failed: runc create failed: unable to start container process: error during container init: error mounting "proc" to rootfs at "/proc": mount src=proc, dst=/proc, dstFd=/proc/thread-self/fd/9, flags=0xe: no such file or directory: unknown
Error: failed to start containers: ubuntu_latest

Kindly help.
Thank You.

Hi @dpakmishra.1983

Thanks for highlighting this.
I’ve reported this to the team and will update you when I receive more information.

can you please post the output of command: docker inspect ubuntu_latest

"It’s done! Here’s what I did:

# I started by checking the Docker images and containers:



[root@stapp02 steve]# docker images
REPOSITORY   TAG     IMAGE ID       CREATED       SIZE
ubuntu       latest  e0f16e6366fe  4 weeks ago   78.1MB

[root@stapp02 steve]# docker ps -a
CONTAINER ID  IMAGE    COMMAND      CREATED       STATUS           PORTS  NAMES
fd0cdefd3239  ubuntu   "/bin/bash"  58 seconds ago  Up 56 seconds         ubuntu_latest


# Note: that the container ubuntu_latest was in the "Up" state this time, unlike earlier when it was in the "Created" state.

# I then committed the container to create a new image:



[root@stapp02 steve]# docker commit ubuntu_latest cluster:nautilus
sha256:95607532f9b57aae3ed1948b4101c933d08028fa7b365d47d0b7c077f40f44ba


# After committing, I verified the container status and the new image:



[root@stapp02 steve]# docker ps -a
CONTAINER ID  IMAGE    COMMAND      CREATED       STATUS           PORTS  NAMES
fd0cdefd3239  ubuntu   "/bin/bash"  3 minutes ago  Up 3 minutes         ubuntu_latest

[root@stapp02 steve]# docker images
REPOSITORY   TAG     IMAGE ID       CREATED       SIZE
cluster      nautilus 95607532f9b5  32 seconds ago  131MB
ubuntu       latest  e0f16e6366fe  4 weeks ago   78.1MB


# The new image cluster:nautilus was successfully created!"

Note: This time the status is “Up 56 seconds” as compared to earlier one which was “Created”


Many thanks @abir101 for your reply.