I lose my data when I get out of the container

0 votes
I lose the data everytime I leave the container or when the container exits(idk if exits is the right word to use here).

Is there something wrong with my installation?

If not please let me know whats the issue
Jul 26, 2018 in Docker by Hannah
• 18,570 points

1 answer to this question.

0 votes

No its not installation issue.

You need to commit the changes you make to the container and then run it. Try this:

sudo docker pull ubuntu
sudo docker run ubuntu apt-get install -y ping

Then get the container id using this command:

sudo docker ps -l

Commit changes to the container:

sudo docker commit <container_id> iman/ping 

Then run the container:

sudo docker run iman/ping ping www.google.com

This should work.

answered Jul 26, 2018 by Kalgi
• 52,370 points

Related Questions In Docker

0 votes
1 answer

Will I lose my data, when a docker container exists?

No, you won’t lose any data when ...READ MORE

answered Jul 30, 2019 in Docker by Kavya
0 votes
1 answer

Why do I get Connection reset by peer when making a request to a service running in a container?

Typically, this message is returned if the ...READ MORE

answered Jul 10, 2019 in Docker by Sirajul
• 59,090 points
0 votes
1 answer

if I remove one container will my volume also get deleted

If the volume is being referenced to ...READ MORE

answered Nov 25, 2019 in Docker by Aria
+2 votes
1 answer
+2 votes
1 answer

Deploy Docker Containers from Docker Cloud

To solve this problem, I followed advice ...READ MORE

answered Sep 3, 2018 in AWS by Priyaj
• 58,140 points
0 votes
2 answers

How can I inspect the file system of a failed `docker build

Failed command is a build that has ...READ MORE

answered Aug 6, 2018 in Docker by Nilesh
• 7,040 points
0 votes
1 answer

Docker, how to get container information from within the container?

I've found out that the container id ...READ MORE

answered Jul 31, 2018 in Docker by Kalgi
• 52,370 points