一行命令安装docker和docker-compose(CentOS7)
程序员文章站
2023-11-03 14:21:52
想快速装好docker和docker compose ?那就随本文用一次复制粘贴来完成安装: 环境信息 1. 操作系统:CentOS Linux release 7.7.1908 (Core, 2. 操作账号:root 3. Docker版本:当前最新版本:19.03.2 4. docker com ......
想快速装好docker和docker-compose ?那就随本文用一次复制粘贴来完成安装:
环境信息
- 操作系统:centos linux release 7.7.1908 (core,
- 操作账号:root
- docker版本:当前最新版本:19.03.2
- docker-compose版本:当前最新版本:1.24.1
安装
执行以下命令(若非root账号,请自行添加sudo):
yum install -y yum-utils device-mapper-persistent-data lvm2 \ && yum-config-manager \ --add-repo \ https://download.docker.com/linux/centos/docker-ce.repo \ && yum install -y docker-ce docker-ce-cli containerd.io \ && systemctl start docker \ && yum -y install epel-release \ && yum -y install python-pip \ && pip install --upgrade pip \ && pip install docker-compose
等待几分钟,即完成docker和docker-compose的安装
验证
- docker版本:
[root@centos7 ~]# docker version client: docker engine - community version: 19.03.2 api version: 1.40 go version: go1.12.8 git commit: 6a30dfc built: thu aug 29 05:28:55 2019 os/arch: linux/amd64 experimental: false server: docker engine - community engine: version: 19.03.2 api version: 1.40 (minimum version 1.12) go version: go1.12.8 git commit: 6a30dfc built: thu aug 29 05:27:34 2019 os/arch: linux/amd64 experimental: false containerd: version: 1.2.6 gitcommit: 894b81a4b802e4eb2a91d1ce216b8817763c29fb runc: version: 1.0.0-rc8 gitcommit: 425e105d5a03fabd737a126ad93d62a9eeede87f docker-init: version: 0.18.0 gitcommit: fec3683
- docker-compose版本:
[root@centos7 ~]# docker-compose version docker-compose version 1.24.1, build 4667896 docker-py version: 3.7.3 cpython version: 2.7.5 openssl version: openssl 1.0.2k-fips 26 jan 2017
- 运行hello world:
[root@centos7 ~]# docker run --rm hello-world unable to find image 'hello-world:latest' locally latest: pulling from library/hello-world 1b930d010525: pull complete digest: sha256:b8ba256769a0ac28dd126d584e0a2011cd2877f3f76e093a7ae560f2a5301c00 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/
操作完成,希望这一次复制粘贴能助您快速开启docker之旅。
上一篇: vue 的 solt 子组件过滤过程解析
下一篇: 儿童奶粉排行榜有哪些奶粉占了上风
推荐阅读
-
一行命令安装docker和docker-compose(CentOS7)
-
Ubuntu15.10安装docker和docker-compose教程
-
Docker-compose的安装和设定详细步骤
-
安装docker和docker-compose实例详解
-
Ubuntu 18.04 安装Docker 和 Docker-Compose方法
-
CentOS7安装docker和docker-compose
-
docker-compose的安装和使用详解
-
docker和docker-compose一键安装教程(支持在线和离线)
-
Docker-compose的安装和设定详细步骤
-
Ubuntu15.10安装docker和docker-compose教程