linux环境安装docker和dockercompose 命令页表快速完成

简介: 此文目的,  如果你熟悉docker, 就没必要每次都去一个一个命令开始复制 粘贴 执行 浪费时间.  直接把整理好的所有命令放入一次执行即可. 如果你是小白, 需要直接搭建环境成功,看到直观效果, 这里就可以.
此文目的, 
  1. 如果你熟悉docker, 就没必要每次都去一个一个命令开始复制 粘贴 执行 浪费时间.  直接把整理好的所有命令放入一次执行即可.
  2. 如果你是小白, 需要直接搭建环境成功,看到直观效果, 这里就可以. 可以增长信息,提升学习兴趣. 不至于浪费时间太多,热情冷却.

docker快速直接执行:

#Uninstall old versions
O#lder versions of Docker were called docker or docker-engine. If these are installed, uninstall them, along with associated 
sudo yum remove docker \
                  docker-client \
                  docker-client-latest \
                  docker-common \
                  docker-latest \
                  docker-latest-logrotate \
                  docker-logrotate \
                  docker-selinux \
                  docker-engine-selinux \
                  docker-engine

#SET UP THE REPOSITORY
#Install required packages. yum-utils provides the yum-config-manager utility, and device-mapper-persistent-data and lvm2 are required by the devicemapper storage driver.
 sudo yum install -y yum-utils \
  device-mapper-persistent-data \
  lvm2

#Use the following command to set up the stable repository. You always need the stable repository, even if you want to install builds from the edge or test repositories as well.
 sudo yum-config-manager \
    --add-repo \
    https://download.docker.com/linux/centos/docker-ce.repo

#Optional: Enable the edge and test repositories. These repositories are included in the docker.repo file above but are disabled by default. You can enable them alongside the stable repository.
sudo yum-config-manager --enable docker-ce-edge
sudo yum-config-manager --enable docker-ce-test
#You can disable the edge or test repository by running the yum-config-manager command with the --disable flag. To re-enable it, use the --enable flag. The following command disables the edge repository.
sudo yum-config-manager --disable docker-ce-edge

#INSTALL DOCKER CE
#Install the latest version of Docker CE, or go to the next step to install a specific version:
sudo yum install docker-ce

#If prompted to accept the GPG key, verify that the fingerprint matches 060A 61C5 1B55 8A7F 742B 77AA C52F EB6B 621E 9F35, and if so, accept it
#Got multiple Docker repositories?
#If you have multiple Docker repositories enabled, installing or updating without specifying a version in the yum install or yum update command always installs the highest possible version, which may not be appropriate for your stability needs.
#Docker is installed but not started. The docker group is created, but no users are added to the group.
#To install a specific version of Docker CE, list the available versions in the repo, then select and install:
#a. List and sort the versions available in your repo. This example sorts results by version number, highest to lowest, and is truncated:
yum list docker-ce --showduplicates | sort -r

#Start Docker.
sudo systemctl start docker

#Verify that docker is installed correctly by running the hello-world image.
 sudo docker run hello-world

docker-compose快速直接执行:
#Run this command to download the latest version of Docker Compose:
sudo curl -L "https://github.com/docker/compose/releases/download/1.22.0/docker-compose-$(uname -s)-$(uname -m)" -o /usr/local/bin/docker-compose

#Apply executable permissions to the binary:
sudo chmod +x /usr/local/bin/docker-compose

#Test the installation.
docker-compose --version


参考:

安装docker和docker-compose

具体安装步骤:

注意:Docker安装要求Linux 3.10以上版本,用uname -a命令可查看到。

安装之后,可查看版本:

$ docker -v
$ docker-compose -v

然后把当前用户加到docker用户组里面:

$ sudo gpasswd -a ${USER} docker

就不用每次启动Docker都得加sudo了。

注意,执行gpasswd命令之后要重新登陆才有效。

来源: https://www.awaimai.com/2120.html


阿里云服务器在搞限时活动优惠卷, 100多个产品通用, 需要的自取. 注意, 领取的优惠券30天内有效,尽快使用!
领取链接:
https://promotion.aliyun.com/ntms/act/ambassador/sharetouser.html?userCode=s306eooi&utm_source=s306eooi

相关文章
|
13天前
|
存储 算法 Linux
【实战项目】网络编程:在Linux环境下基于opencv和socket的人脸识别系统--C++实现
【实战项目】网络编程:在Linux环境下基于opencv和socket的人脸识别系统--C++实现
37 6
|
3天前
|
机器学习/深度学习 缓存 监控
linux查看CPU、内存、网络、磁盘IO命令
`Linux`系统中,使用`top`命令查看CPU状态,要查看CPU详细信息,可利用`cat /proc/cpuinfo`相关命令。`free`命令用于查看内存使用情况。网络相关命令包括`ifconfig`(查看网卡状态)、`ifdown/ifup`(禁用/启用网卡)、`netstat`(列出网络连接,如`-tuln`组合)以及`nslookup`、`ping`、`telnet`、`traceroute`等。磁盘IO方面,`iostat`(如`-k -p ALL`)显示磁盘IO统计,`iotop`(如`-o -d 1`)则用于查看磁盘IO瓶颈。
|
13天前
|
NoSQL Linux Shell
常用的 Linux 命令
常用的 Linux 命令
35 9
|
1天前
|
Ubuntu Linux Shell
linux免交互登陆远程主机并执行命令(密钥对和Expect)
linux免交互登陆远程主机并执行命令(密钥对和Expect)
|
1天前
|
Linux
【Linux】常用命令
【Linux】常用命令
5 0
|
1天前
|
安全 Ubuntu Linux
Linux 网络操作命令Telnet
Linux 网络操作命令Telnet
4 0
Linux 网络操作命令Telnet
|
1天前
|
监控 Docker 容器
Docker从入门到精通:Docker log 命令学习
了解 Docker 日志管理对容器监控至关重要。`docker logs` 命令用于查看和管理容器日志,例如,`docker logs <container_name>` 显示容器日志,`-f` 或 `--follow` 实时跟踪日志,`--tail` 显示指定行数,`--timestamps` 添加时间戳,`--since` 按日期筛选。Docker 支持多种日志驱动,如 `syslog`,可通过 `--log-driver` 配置。有效管理日志能提升应用程序的稳定性和可维护性。
2 0
|
1天前
|
Ubuntu Linux 测试技术
Linux(32)Rockchip RK3568 Ubuntu22.04上部署 Docker: 详细配置与功能测试(下)
Linux(32)Rockchip RK3568 Ubuntu22.04上部署 Docker: 详细配置与功能测试
10 1
|
1天前
|
Linux 开发工具 Android开发
Docker系列(1)安装Linux系统编译Android源码
Docker系列(1)安装Linux系统编译Android源码
3 0
|
2天前
|
Linux 数据安全/隐私保护
Linux常用命令实例带注释
Linux常用命令实例带注释
24 0