centos8 安装docker
菜鸟教程卸载旧版sudo yum remove docker \docker-client \docker-client-latest \docker-common \docker-latest \docker-latest-logrotate \docker-logrotate
·
卸载旧版
sudo yum remove docker docker-client docker-client-latest docker-common docker-latest docker-latest-logrotate docker-logrotate docker-engine
官方脚本自动安装
curl -fsSL https://get.docker.com | bash -s docker --mirror Aliyun
安装日志记录
[root@localhost ~]# curl -fsSL https://get.docker.com | bash -s docker --mirror Aliyun
# Executing docker install script, commit: 7cae5f8b0decc17d6571f9f52eb840fbc13b2737
+ sh -c 'yum install -y -q yum-utils'
警告:/var/cache/dnf/baseos-929b586ef1f72f69/packages/yum-utils-4.0.17-5.el8.noarch.rpm: 头V3 RSA/SHA256 Signature, 密钥 ID 8483c65d: NOKEY
导入 GPG 公钥 0x8483C65D:
Userid: "CentOS (CentOS Official Signing Key) <security@centos.org>"
指纹: 99DB 70FA E1D7 CE22 7FB6 4882 05B5 55B3 8483 C65D
来自: /etc/pki/rpm-gpg/RPM-GPG-KEY-centosofficial
+ sh -c 'yum-config-manager --add-repo https://mirrors.aliyun.com/docker-ce/linux/centos/docker-ce.repo'
添加仓库自:https://mirrors.aliyun.com/docker-ce/linux/centos/docker-ce.repo
+ '[' stable '!=' stable ']'
+ sh -c 'yum makecache'
CentOS Linux 8 - AppStream 5.5 kB/s | 4.3 kB 00:00
CentOS Linux 8 - BaseOS 3.2 kB/s | 3.9 kB 00:01
CentOS Linux 8 - Extras 2.7 kB/s | 1.5 kB 00:00
Docker CE Stable - x86_64 23 kB/s | 12 kB 00:00
元数据缓存已建立。
+ '[' -n '' ']'
+ sh -c 'yum install -y -q docker-ce'
警告:/var/cache/dnf/docker-ce-stable-ab4061364e2cf0db/packages/containerd.io-1.4.4-3.1.el8.x86_64.rpm: 头V4 RSA/SHA512 Signature, 密钥 ID 621e9f35: NOKEY
导入 GPG 公钥 0x621E9F35:
Userid: "Docker Release (CE rpm) <docker@docker.com>"
指纹: 060A 61C5 1B55 8A7F 742B 77AA C52F EB6B 621E 9F35
来自: https://mirrors.aliyun.com/docker-ce/linux/centos/gpg
+ '[' -n 1 ']'
+ sh -c 'yum install -y -q docker-ce-rootless-extras'
================================================================================
To run Docker as a non-privileged user, consider setting up the
Docker daemon in rootless mode for your user:
dockerd-rootless-setuptool.sh install
Visit https://docs.docker.com/go/rootless/ to learn about rootless mode.
To run the Docker daemon as a fully privileged service, but granting non-root
users access, refer to https://docs.docker.com/go/daemon-access/
WARNING: Access to the remote API on a privileged Docker daemon is equivalent
to root access on the host. Refer to the 'Docker daemon attack surface'
documentation for details: https://docs.docker.com/go/attack-surface/
================================================================================
[root@localhost ~]#
查看状态
命令systemctl status docker
启动
命令systemctl start docker
开机启动 systemctl enable docker.service
关闭systemctl disable docker.service
常用命令
查看所有镜像 docker images
删除镜像(会提示先停止使用中的容器) docker rmi 镜像name/镜像id
查看所有容器 docker ps -a
查看容器运行日志 docker logs 容器名称/容器id
停止容器运行 docker stop 容器name/容器id
终止容器后运行 docker start 容器name/容器id
容器重启 docker restart 容器name/容器id
删除容器 docker rm 容器name/容器id
Docker 拉取 oracle 11g镜像配置
数据持久化
开机启动 docker update --restart=always oracle11g
# 显式创造卷
docker volume create mariadb
# 以卷的方式持久化
# root/root 192.168.232.130:3306
docker run -d -p 3306:3306 --name imariadb --restart=always -v mariadb:/var/lib/mysql -e MYSQL_ROOT_PASSWORD=root mariadb:latest
更多推荐
已为社区贡献6条内容
所有评论(0)