一)挂载宿主机目录作为数据卷
使用--mount标记可以指定挂载一个宿主机的目录到容器中去。
# docker run -it --mount type=bind,source=/opt/sharefolder,target=/opt/sharefolder imageID bash //容器将共享宿主机的/opt/sharefolder目录以方便数据共享
二)启动的容器中运行systemctl命令,报错:Failed to get D-Bus connection: Operation not permitted
解决方案:
http://www.hainiubl.com/topics/1
总结如下:
step1:
创建Dockerfile文件:

Step2:
重新build镜像:

Step3:
实例化container(该container将具有systemctl权限):

















