1.掌握 Docker 容器的基本原理
2.掌握 Docker 容器创建与基本操作
二、实验设计
1.安装 Docker
(1)搜索并进入 https://www.docker.com/get-docker
(2)选择 Lunix 再选择 Ubuntu
(3)根据 Install Docker Desktop 进行安装
(4)打开虚拟机终端在终端里面输入第(3)步中的安装命令如下
sudo apt-get update
sudo apt-get install \
ca-certificates \
curl \
gnupg \
lsb-release
sudo mkdir -p /etc/apt/keyrings
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo gpg
--dearmor -o /etc/apt/keyrings/docker.gpg
echo \
"deb [arch=$(dpkg --print-architecture)
signed-by=/etc/apt/keyrings/docker.gpg]
https://download.docker.com/linux/ubuntu \
$(lsb_release -cs) stable" | sudo tee /etc/apt/sources.list.d/docker.list
> /dev/null
sudo apt-get update
sudo apt-get install docker-ce docker-ce-cli containerd.io
docker-compose-plugin
apt-cache madison docker-ce
sudo apt-get install docker-ce=<VERSION_STRING>
docker-ce-cli=<VERSION_STRING> containerd.io docker-compose-plugin
sudo service docker start
sudo docker run hello-world
2.设置管理员权限在虚拟机终端里面分别输入以下命令
sudo groupadd docker
sudo usermod -aG docker $USER
newgrp docker
docker run hello-world
3.容器创建、启动和互联
docker run -itd --name=b1 busybox
docker run -itd -- link b1 –name=b2 busybox
docker exec -it b2 /bin/sh
三、实验记录
评论0
最新资源