一、新手入门 – 安装Docker

By | 2019-12-11

前言: 在Linux环境下安装 Docker,体验一下『开箱即用』的快感吧!

安装非常简单,几行命令就好了,该文支持ubuntu 14.04 版本以上

  • apt update && apt upgrade -y   [先把系统升级到最新]
  • apt-get remove docker docker-engine docker.io containerd runc     [把旧版本的Docker完全卸载删除,该步骤可跳过]
  • apt-get install apt-transport-https ca-certificates curl gnupg-agent software-properties-common
  • curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add –
  • add-apt-repository “deb [arch=amd64] https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable”
  • apt update
  • apt-get install docker-ce docker-ce-cli containerd.io

完成安装!

重启电脑自动启动DOCKER

systemctl enable caddy.service

常用命令:

#docker container ls  查看所有容器的id
#docker update --restart=always d1234abc834 更改容器的启动参数
#docker network create -d macvlan --subnet=192.168.1.0/24 --gateway=192.168.1.254 -o parent=eth0 macnet
添加名为macvlan的网络 subnet 指网段 gateway 主路由的IP

發佈留言