docker的安装——玩转alpine linux

在安装docker 之前请参考 apk软件管理——玩转alpine linux 一文配置好阿里云的apk源,避免找不到docker软件包。

  1. apk update 更新一下本地软件索引缓存。
edge:~# apk update
fetch https://mirror.tuna.tsinghua.edu.cn/alpine/v3.14/community/x86_64/APKINDEX.tar.gz
fetch https://mirrors.aliyun.com/alpine/v3.14/main/x86_64/APKINDEX.tar.gz
v3.14.0-165-g01e8bc9b28 [https://mirror.tuna.tsinghua.edu.cn/alpine/v3.14/community]
v3.14.0-160-g18a21f8aa5 [https://mirrors.aliyun.com/alpine/v3.14/main/]
OK: 14931 distinct packages available
  1. apk search docker可以看到列出docker相关的软件包,说明apk源没问题。
edge:~# apk search docker
docker-bash-completion-20.10.7-r1
py3-dockerpty-0.4.1-r3
docker-cli-20.10.7-r1
podman-docker-3.2.3-r0
openvswitch-2.12.3-r1
docker-engine-20.10.7-r1
docker-openrc-20.10.7-r1
docker-fish-completion-20.10.7-r1
docker-py-5.0.0-r0
openvswitch-ovn-2.12.3-r1
docker-registry-openrc-2.7.1-r4
docker-doc-20.10.7-r1
rsyslog-imdocker-8.2012.0-r1
docker-compose-bash-completion-1.28.0-r1
docker-compose-1.28.0-r1
docker-compose-zsh-completion-1.28.0-r1
docker-registry-2.7.1-r4
docker-credential-ecr-login-0.5.0-r1
dockerpy-creds-0.4.0-r2
docker-credential-ecr-login-doc-0.5.0-r1
podman-docker-doc-3.2.3-r0
docker-20.10.7-r1
docker-compose-fish-completion-1.28.0-r1
docker-zsh-completion-20.10.7-r1
docker-cli-buildx-0.5.1-r0
  1. apk add docker安装docker以及依赖的包。
edge:~# apk add docker
(1/15) Installing libseccomp (2.5.1-r2)
(2/15) Installing runc (1.0.0_rc95-r1)
(3/15) Installing containerd (1.5.4-r0)
(4/15) Installing libmnl (1.0.4-r1)
(5/15) Installing libnftnl-libs (1.2.0-r0)
(6/15) Installing iptables (1.8.7-r1)
(7/15) Installing iptables-openrc (1.8.7-r1)
(8/15) Installing ip6tables (1.8.7-r1)
(9/15) Installing ip6tables-openrc (1.8.7-r1)
(10/15) Installing tini-static (0.19.0-r0)
(11/15) Installing docker-engine (20.10.7-r1)
(12/15) Installing docker-openrc (20.10.7-r1)
(13/15) Installing docker-cli (20.10.7-r1)
(14/15) Installing docker (20.10.7-r1)
Executing docker-20.10.7-r1.pre-install
(15/15) Installing docker-zsh-completion (20.10.7-r1)
Executing busybox-1.33.1-r3.trigger
OK: 1264 MiB in 189 packages
  1. service docker start启动docker。
edge:~# service docker start
 * Caching service dependencies ...                                                                                                                                                     [ ok ]
 * Mounting cgroup filesystem ...                                                                                                                                                       [ ok ]
 * /var/log/docker.log: creating file
 * /var/log/docker.log: correcting owner
 * Starting Docker Daemon ...   
  1. docker info查看docker 信息,说明安装成功了。
edge:~# docker info
Client:
 Context:    default
 Debug Mode: false

Server:
 Containers: 0
  Running: 0
  Paused: 0
  Stopped: 0
 Images: 0
 Server Version: 20.10.7
 Storage Driver: overlay2
  Backing Filesystem: extfs
  Supports d_type: true
  Native Overlay Diff: true
  userxattr: false
 Logging Driver: json-file
 Cgroup Driver: cgroupfs
 Cgroup Version: 1
 Plugins:
  Volume: local
  Network: bridge host ipvlan macvlan null overlay
  Log: awslogs fluentd gcplogs gelf journald json-file local logentries splunk syslog
 Swarm: inactive
 Runtimes: io.containerd.runc.v2 io.containerd.runtime.v1.linux runc
 Default Runtime: runc
 Init Binary: docker-init
 containerd version: a62e1d690afa2b9b1d43f8ece3ff4483
 runc version: b9ee9c6314599f1b4a7f497e1f1f856fe433d3b7
 init version: 
 Security Options:
  seccomp
   Profile: default
 Kernel Version: 5.10.43-0-lts
 Operating System: Alpine Linux v3.14
 OSType: linux
 Architecture: x86_64
 CPUs: 2
 Total Memory: 1.942GiB
 Name: edge
 ID: H2HZ:ZAOQ:MPJK:NFJA:B72G:CVG7:KTUK:F57Y:7MKT:XCCG:Q6OG:IRN3
 Docker Root Dir: /var/lib/docker
 Debug Mode: false
 Registry: https://index.docker.io/v1/
 Labels:
 Experimental: false
 Insecure Registries:
  127.0.0.0/8
 Live Restore Enabled: false

  1. 开机启动配置
    安装完后记得配置开机启动。
rc-update add docker

你可能感兴趣的:(操作系统,docker,linux,alpine)