Docker Community Forums

Share and learn in the Docker community.

What happens to uncommitted container


(Mulpuru) #1

Hi,

Quick newbie question, what happens to uncommitted container?

for example i spun up ubuntu:latest container

docker run -it --name ubuntu_container1 ubuntu /bin/bash
apt-get update
docker stop ubuntu_container1

i understand i can create new layer later on using - docker commit ubuntu_container1 but what if i didn’t;

does this consume space on the docker host ?
does this space get purged on schedule?
Can the container name reused for a different image?

Thanks


(Sabin Basyal) #2

To answer your queries:

does this consume space on the docker host ?

Yes, it will consume space if you just do docker stop, unless you delete the container.
It is because, if you do docker start ubuntu_container1, it will start the same container, although not committed as image.

does this space get purged on schedule?

Not untile you remove the container with docker rm <container-id>, the space is not purged.

Can the container name reused for a different image?

No, you cannot use the same name, even if the container is stopped.
You can check all the stopped containers suing docker ps -a.