sudo curl -fsSL https://get.docker.com | bash -s docker --mirror Aliyun
执行时间
2021-1-215:14:18
执行系统
yonghuming@ubuntu:~$ uname -a
Linux ubuntu 4.4.0-194-generic #226-Ubuntu SMP Wed Oct 2110:19:36 UTC 2020 x86_64 x86_64 x86_64 GNU/Linux
yonghuming@ubuntu:~$ cat /etc/os-release
NAME="Ubuntu"
VERSION="16.04.1 LTS (Xenial Xerus)"
ID=ubuntu
ID_LIKE=debian
PRETTY_NAME="Ubuntu 16.04.1 LTS"
VERSION_ID="16.04"
HOME_URL="http://www.ubuntu.com/"
SUPPORT_URL="http://help.ubuntu.com/"
BUG_REPORT_URL="http://bugs.launchpad.net/ubuntu/"
UBUNTU_CODENAME=xenial
执行结果,新安装了以下包
ii containerd.io 1.4.3-1 amd64 An open and reliable container runtime
ii docker-ce 5:20.10.1~3-0~ubuntu-xenial amd64 Docker: the open-source application container engine
ii docker-ce-cli 5:20.10.1~3-0~ubuntu-xenial amd64 Docker CLI: the open-source application container engine
docker 架构
1.创建一个 容器
2.从特定仓库下载一个特定镜像
3.将镜像释放到该容器
docker 测试
$ sudo docker run hello-world
Unable to find image 'hello-world:latest' locally
latest: Pulling from library/hello-world
0e03bdcc26d7: Pull complete
Digest: sha256:1a523af650137b8accdaed439c17d684df61ee4d74feac151b5b337bd29e7eec
Status: Downloaded newer image for hello-world:latest
Hello from Docker!
This message shows that your installation appears to be working correctly.
To generate this message, Docker took the following steps:1. The Docker client contacted the Docker daemon.2. The Docker daemon pulled the "hello-world" image from the Docker Hub.(amd64)3. The Docker daemon created a new container from that image which runs the
executable that produces the output you are currently reading.4. The Docker daemon streamed that output to the Docker client, which sent it
to your terminal.
To try something more ambitious, you can run an Ubuntu container with:
$ docker run -it ubuntu bash
Share images, automate workflows, and more with a free Docker ID:
https://hub.docker.com/
For more examples and ideas, visit:
https://docs.docker.com/get-started/
做了什么
run Run a command in a new container
附录
安装过程
$ sudo curl -fsSL https://get.docker.com | bash -s docker --mirror Aliyun
# Executing docker install script, commit: 3d8fe77c2c46c5b7571f94b42793905e5b3e42e4+ sudo -E sh -c 'apt-get update -qq >/dev/null'
AppStream cache update completed, but some metadata was ignored due to errors.+ sudo -E sh -c 'DEBIAN_FRONTEND=noninteractive apt-get install -y -qq apt-transport-https ca-certificates curl >/dev/null'+ sudo -E sh -c 'curl -fsSL "https://mirrors.aliyun.com/docker-ce/linux/ubuntu/gpg" | apt-key add -qq - >/dev/null'+ sudo -E sh -c 'echo "deb [arch=amd64] https://mirrors.aliyun.com/docker-ce/linux/ubuntu xenial stable" > /etc/apt/sources.list.d/docker.list'+ sudo -E sh -c 'apt-get update -qq >/dev/null'+'['-n ''']'+ sudo -E sh -c 'apt-get install -y -qq --no-install-recommends docker-ce >/dev/null'+ sudo -E sh -c 'docker version'
Client: Docker Engine - Community
Version:20.10.1
API version:1.41
Go version: go1.13.15
Git commit:831ebea
Built: Tue Dec 1504:35:012020
OS/Arch: linux/amd64
Context:default
Experimental: true
Server: Docker Engine - Community
Engine:
Version:20.10.1
API version:1.41(minimum version 1.12)
Go version: go1.13.15
Git commit: f001486
Built: Tue Dec 1504:32:572020
OS/Arch: linux/amd64
Experimental: false
containerd:
Version:1.4.3
GitCommit:269548fa27e0089a8b8278fc4fc781d7f65a939b
runc:
Version:1.0.0-rc92
GitCommit: ff819c7e9184c13b7c2607fe6c30ae19403a7aff
docker-init:
Version:0.19.0
GitCommit: de40ad0
If you would like to use Docker as a non-root user, you should now consider
adding your user to the "docker" group with something like:
sudo usermod -aG docker yonghuming
Remember that you will have to log out and back in for this to take effect!
WARNING: Adding a user to the "docker" group will grant the ability to run
containers which can be used to obtain root privileges on the
docker host.
Refer to https://docs.docker.com/engine/security/security/#docker-daemon-attack-surface
for more information.