码迷,mamicode.com
首页 > 其他好文 > 详细

[Docker] Create a Volume

时间:2017-04-21 20:06:42      阅读:227      评论:0      收藏:0      [点我收藏+]

标签:oca   let   run   rom   pac   container   keep   round   back   

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

标签:oca   let   run   rom   pac   container   keep   round   back   

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

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!