Docker容器的特權模式介紹


  • 啟動一個普通的容器
    • docker run -itd --name centos centos:7
  • 安裝網絡工具
    • yum install -y net-tools
  • 執行route -n
  • 刪除網關
    • route del default gw 172.17.0.2
    • 刪除失敗:SIOCDELRT: Operation not permitted
  • 啟動擁有特權模式的容器
    • docker run -itd --privileged=true --name mycentos1 centos:7
  • 進入容器
    • docker exec -it 容器id /bin/bash
  • 刪除網關
    • route del default gw 172.17.0.2
    • 刪除成功

備注:特權模式使用較少


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM