Reputation: 1525
I am newbie to docker and trying to explore the features of docker. I created a container and stored some data on it and pushed it onto my docker account.
But, when I am pulling the same container I am not able to see the data which I stored in the container. Why my data is not available?
Where has my data gone?
UPDATE
I performed following steps:
ubuntu@domU-12-31-39-0A-11-9F:~$ sudo docker run -i -t ubuntu /bin/bash
Unable to find image 'ubuntu' locally Pulling repository ubuntu
xxxxxxxxxxxx: Download complete xxxxxxxxxxxx: Download complete xxxxxxxxxxxx: Download complete xxxxxxxxxxxx: Download complete xxxxxxxxxxxx: Download complete xxxxxxxxxxxx: Download complete xxxxxxxxxxxx: Download complete xxxxxxxxxxxx: Download complete xxxxxxxxxxxx: Download complete xxxxxxxxxxxx: Download complete xxxxxxxxxxxx: Download complete
root@xxxxxxxxxxxx:
Here I did the changes and then I commited the container
ubuntu@domU-12-31-39-07-76-B4:~$ sudo docker commit xxxxxxxxxxxx ubuntu 0fd6b6b8acd3dc49947611e61077600a93a6285ebdcf45f1a8f73b4a26274fee
ubuntu@domU-12-31-39-07-76-B4:~$ sudo docker push myrepositoryname/ubuntu The push refers to a repository [myrepositoryname/ubuntu] (len: 1) Sending image list
Please login prior to push: Username: xxxx Password: Email: xxxxxxxx Login Succeeded The push refers to a repository [myrepositoryname/ubuntu] (len: 1) Sending image list Pushing repository myrepositoryname/ubuntu (1 tags) 511136ea3c5a: Image already pushed, skipping Image xxxxxxxxxxxx already pushed, skipping Image xxxxxxxxxxxx already pushed, skipping Image xxxxxxxxxxxx already pushed, skipping Pushing tag for rev [xxxxxxxxxxxx] on {https:// repository name}
After it I checked in my docker account, the image got pushed. After that I created a new account and pulled the image (I made the image public). But,I am not getting my data
ubuntu@domU-12-31-39-14-1D-8F:~$ sudo docker login
Username: xxxx Password: Email: xxxxxxxxxxxx Account created. Please use the confirmation link we sent to your e-mail to activate it.
ubuntu@domU-12-31-39-14-1D-8F:~$ sudo docker login
Username (xxxx): xxxxx
Login Succeeded
ubuntu@domU-12-31-39-14-1D-8F:~$ sudo docker pull myrepositoryname/ubuntu
Pulling repository myrepositoryname/ubuntu 6d38862b09be: Download complete 511136ea3c5a: Download complete 6170bb7b0ad1: Download complete 9cd978db300e: Download complete
ubuntu@domU-12-31-39-14-1D-8F:~$ sudo docker run -i -t myrepositoryname/ubuntu /bin/bash
root@7b7cc51fbd90:/# cd home/ root@7b7cc51fbd90:/home# ls
I stored my data in /home path but when I am checking there is no data
Upvotes: 0
Views: 2937
Reputation: 27236
Did you create an image?
When you docker run
an image (with n
file layers, see http://docs.docker.io/en/latest/terms/layer/) you create an n+1
'th file layer on top of that. That is where you stored your data in. If you docker stop
your container, that data remains in that layer, and when you re-docker start
your container the data is still there.
However, if you docker run
your image again, you make a different container which does not have that data.
Now, you want to send your data to the index (your Docker account). You can only send images, not containers, and the image you used does not contain this data. Therefore, you need to docker commit
your container to a new image, and the you can docker push
the resulting image. docker pull
ing that should give you a startable image containing the data.
Upvotes: 3