Cannot save docker container

Advertisements

To start off, I am new to docker.
I am running docker on a ubuntu server.

I created a new container using

 sudo docker run -ti --rm ubuntu /bin/bash

but when I try to save

root@fb3811666c85:/# docker commit -p fb3811666c85 mycontainer

I get

bash: docker: command not found

I also tried

root@fb3811666c85:/# sudo docker commit -p fb3811666c85 mycontainer

and got

sudo: docker: command not found

What am I doing wrong?

>Solution :

This command is not run from within the container. (Your container doesn’t have docker, so the error is obvious. But even if it had docker, it wouldn’t achieve the result that you are seeking. Might probably complain about the container being not available. If you are using the host socket, then it might not happen).

In one terminal open a container, make changes that you want.
In second terminal, run docker ps. Copy the container id. Run the command.
In your command, instead of myContainer, I think you’d want to use myImage:myNewTag.

Leave a ReplyCancel reply