DOCKER常用配置

一)掛載宿主機目錄作爲數據卷

使用--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

解決方案:啓動容器的時候加上/usr/sbin/init參數

eg. docker run -dit --privileged centos /usr/sbin/init


發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章