docker安装ubuntu20.04

1.下面链接可以选择一键安装docker:

wget http://fishros.com/install -O fishros && . fishros

2.输入以下命令查看docker是否安装成功:

docker --version

3.下载安装镜像文件:

sudo apt-get update
sudo docker pull ubuntu:20.04

4.查看是否下载安装成功:

sudo docker images

5.给docker权限:

sudo chmod 666 /var/run/docker.sock

6.进入ubuntu20.04:

docker run -it ubuntu:20.04 /bin/bash

7.在ubuntu20.04中换源:

rm /etc/apt/sources.list
cat>/etc/apt/sources.list< deb http://mirrors.aliyun.com/ubuntu/ bionic main restricted universe multiverse
> deb http://mirrors.aliyun.com/ubuntu/ bionic-security main restricted universe multiverse
> deb http://mirrors.aliyun.com/ubuntu/ bionic-updates main restricted universe multiverse
> deb http://mirrors.aliyun.com/ubuntu/ bionic-proposed main restricted universe multiverse
> deb http://mirrors.aliyun.com/ubuntu/ bionic-backports main restricted universe multiverse
> deb-src http://mirrors.aliyun.com/ubuntu/ bionic main restricted universe multiverse
> deb-src http://mirrors.aliyun.com/ubuntu/ bionic-security main restricted universe multiverse
> deb-src http://mirrors.aliyun.com/ubuntu/ bionic-updates main restricted universe multiverse
> deb-src http://mirrors.aliyun.com/ubuntu/ bionic-proposed main restricted universe multiverse
> deb-src http://mirrors.aliyun.com/ubuntu/ bionic-backports main restricted universe multiverse
> EOF
cat /etc/apt/sources.list
apt update

8.在Vscode中安装docker插件,就能看到安装的容器

你可能感兴趣的:(环境配置,docker,容器,ubuntu)