首页 > 其他 > 详细

[Docker] Create a Volume

时间:2017-04-21 20:07:40      阅读:277      评论:0      收藏:0      [点我收藏+]

We can create volumn to keep the data, even we stop the container and restart again, the data won‘t get lost.

 

To create a link between the folder /my-files on your host machine and the htdocs folder in the container. This also runs the container in the background.

docker run -d -p 80:80 -v /my-files:/usr/local/apache2/htdocs web-server:1.1

 

After runnning the container, Let’s see what this looks like from inside the container.

Attache a shell to the container:

docker container exec -it elegant_noether /bin/bash

 

cd to folder:

cd /usr/local/apache2/htdocs

 

Now we can use ‘ls -la‘ to see what is inside the folder.

 

[Docker] Create a Volume

原文:http://www.cnblogs.com/Answer1215/p/6745215.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!