Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Docker.IO Filesystem Consistancy

Tags:

docker

I created a docker container, and then I created a file and exited the container.

When I restart the container with:

docker run -i -t ubuntu /bin/bash

the file is nowhere to be found. I checked /var/lib/docker/ and there is another folder created which has my file in it. I know it's something to do with Union FS.

  1. How do I start the same container again with my file in it?
  2. How do I export a container with file change?
like image 931
user2678188 Avatar asked Aug 13 '13 10:08

user2678188


People also ask

What filesystem does Docker use?

Shared storage systems and the storage driver Each Docker storage driver is based on a Linux filesystem or volume manager.

Does a Docker container have a filesystem?

Docker ImageLayers are stacked on top of each other to form a base for a container's root filesystem. The Docker storage driver is responsible for stacking these layers and providing a single unified view.

Are Docker volumes persistent?

Volumes are the best way to persist data in Docker. Bind mounts may be stored anywhere on the host system. They may even be important system files or directories. Non-Docker processes on the Docker host or a Docker container can modify them at any time.

Is Docker slower than bare metal?

Docker containers are not the fastest: While Docker is faster than virtual machines, it is still not as fast as an actual, bare-metal machine. There are various performance overheads associated with containers, primarily due to networking, communication between containers and host systems, and more.


1 Answers

I don't know if this will answer your question completely, but...

Doing docker run -i -t ubuntu /bin/bash will not restart any container. Instead, it will create and start a new container based on the ubuntu image.

If you started a container and stopped it you can use docker start ${CONTAINER_ID}. If you did not stop it yet you can use restart.

You can also commit (export) the container to a new image: see http://docs.docker.io/en/latest/commandline/command/commit/ for the correct syntax. docker export is a option as well, but all that will do is archive your container. By creating a new image using docker commit you can create multiple instances (containers) of it afterwards, all having your file in it.

like image 90
qkrijger Avatar answered Nov 02 '22 07:11

qkrijger