2

I've created 2 docker containers and I tried to install some application on ubuntu,debian and some packages as - mc, ping, traceroute.. but whenever I exit from the container I loose everything from there.. Is any docker command to save my config?

 root@ubuntu:/tmp# docker images
REPOSITORY          TAG                 IMAGE ID            CREATED             SIZE
debian              latest              2b98c9851a37        4 weeks ago         100MB
ubuntu              latest              f975c5035748        5 weeks ago         112MB
ubuntu              14.04               dc4491992653        2 months ago        222MB


root@ubuntu:/tmp# docker ps -q
a3a1c08a3dbd
1c1990b6f014
Slashlinux
  • 57
  • 11

1 Answers1

2

By default, a Docker containers file system is not backed-up and will be deleted when the container gets deleted. In order to persist certain locations inside a Docker container you have to user volumes.

For your case, you will have to persist certain locations such as /bin, '/usr/bin' since these folder will container the binaries for the tools that you are installing.

docker run -it -v bin:/bin -v usr_bin:/usr/bin ubuntu bash

This will work however a better approach is to create a Dockerfile and install the tools you need using a sequence of RUN instructions. This will give a docker image that will contain all the tools you installed, and can be instantiated multiple times to create multiple containers.

FROM <base-image>

RUN apt-get install iputils-ping
yamenk
  • 46,736
  • 10
  • 93
  • 87