Docker:centos79-docker-compose安装记录

news2024/11/28 14:48:10

1.安装环境:centos7.9 x86 

2.安装最新版:

[root@localhost ~]# curl -fsSL get.docker.com -o get-docker.sh
[root@localhost ~]# sh get-docker.sh
# Executing docker install script, commit: e5543d473431b782227f8908005543bb4389b8de
+ sh -c 'yum install -y -q yum-utils'
+ sh -c 'yum-config-manager --add-repo https://download.docker.com/linux/centos/docker-ce.repo'
Loaded plugins: fastestmirror
adding repo from: https://download.docker.com/linux/centos/docker-ce.repo
grabbing file https://download.docker.com/linux/centos/docker-ce.repo to /etc/yum.repos.d/docker-ce.repo
repo saved to /etc/yum.repos.d/docker-ce.repo
+ '[' stable '!=' stable ']'
+ sh -c 'yum makecache'
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
epel/x86_64/metalink                                                                                                                                                                    | 5.0 kB  00:00:00
 * base: mirrors.bfsu.edu.cn
 * epel: mirrors.bfsu.edu.cn
 * extras: mirrors.huaweicloud.com
 * updates: mirrors.huaweicloud.com
base                                                                                                                                                                                    | 3.6 kB  00:00:00
docker-ce-stable                                                                                                                                                                        | 3.5 kB  00:00:00
extras                                                                                                                                                                                  | 2.9 kB  00:00:00
updates                                                                                                                                                                                 | 2.9 kB  00:00:00
(1/13): base/7/x86_64/filelists_db                                                                                                                                                      | 7.2 MB  00:00:00
(2/13): base/7/x86_64/other_db                                                                                                                                                          | 2.6 MB  00:00:00
(3/13): docker-ce-stable/7/x86_64/filelists_db                                                                                                                                          |  57 kB  00:00:01
(4/13): docker-ce-stable/7/x86_64/updateinfo                                                                                                                                            |   55 B  00:00:02
(5/13): docker-ce-stable/7/x86_64/primary_db                                                                                                                                            | 131 kB  00:00:01
(6/13): epel/x86_64/filelists_db                                                                                                                                                        |  12 MB  00:00:00
(7/13): epel/x86_64/prestodelta                                                                                                                                                         | 1.8 kB  00:00:00
(8/13): extras/7/x86_64/other_db                                                                                                                                                        | 150 kB  00:00:00
(9/13): extras/7/x86_64/filelists_db                                                                                                                                                    | 303 kB  00:00:00
(10/13): epel/x86_64/other_db                                                                                                                                                           | 3.4 MB  00:00:00
(11/13): updates/7/x86_64/other_db                                                                                                                                                      | 1.5 MB  00:00:00
(12/13): docker-ce-stable/7/x86_64/other_db                                                                                                                                             | 142 kB  00:00:01
(13/13): updates/7/x86_64/filelists_db                                                                                                                                                  |  14 MB  00:00:00
Metadata Cache Created
+ sh -c 'yum install -y -q docker-ce docker-ce-cli containerd.io docker-compose-plugin docker-ce-rootless-extras docker-buildx-plugin'
warning: /var/cache/yum/x86_64/7/docker-ce-stable/packages/docker-buildx-plugin-0.12.1-1.el7.x86_64.rpm: Header V4 RSA/SHA512 Signature, key ID 621e9f35: NOKEY
Public key for docker-buildx-plugin-0.12.1-1.el7.x86_64.rpm is not installed
Importing GPG key 0x621E9F35:
 Userid     : "Docker Release (CE rpm) <docker@docker.com>"
 Fingerprint: 060a 61c5 1b55 8a7f 742b 77aa c52f eb6b 621e 9f35
 From       : https://download.docker.com/linux/centos/gpg

================================================================================

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 ~]#

 2.检查版本,测试程序

[root@localhost ~]# docker ps
Cannot connect to the Docker daemon at unix:///var/run/docker.sock. Is the docker daemon running?
[root@localhost ~]# docker -v
Docker version 25.0.2, build 29cf629
[root@localhost ~]# systemctl start docker
[root@localhost ~]# systemctl enable docker
Created symlink from /etc/systemd/system/multi-user.target.wants/docker.service to /usr/lib/systemd/system/docker.service.
[root@localhost ~]# docker ps
CONTAINER ID   IMAGE     COMMAND   CREATED   STATUS    PORTS     NAMES
[root@localhost ~]# docker run hello-world
Unable to find image 'hello-world:latest' locally
latest: Pulling from library/hello-world
c1ec31eb5944: Pull complete
Digest: sha256:4bd78111b6914a99dbc560e6a20eab57ff6655aea4a80c50b0c5491968cbc2e6
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/

 3.下载docker-compose:

chmod +x /usr/local/bin/docker-compose

[root@localhost ~]# sudo curl -L https://github.com/docker/compose/releases/download/v2.21.0/docker-compose-`uname -s`-`uname -m` -o /usr/local/bin/docker-compose
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
  0     0    0     0    0     0      0      0 --:--:-- --:--:-- --:--:--     0
100 56.7M  100 56.7M    0     0  75758      0  0:13:05  0:13:05 --:--:--  478k
[root@localhost ~]# chmod +x /usr/local/bin/docker-compose
[root@localhost ~]# docker-compose --version
Docker Compose version v2.21.0
[root@localhost ~]# pip install docker-compose
-bash: pip: command not found

4.下载python

[root@localhost ~]# yum install python
[root@localhost ~]# yum install python-pip
[root@localhost ~]# python
Python 2.7.5 (default, Nov 14 2023, 16:14:06)
[GCC 4.8.5 20150623 (Red Hat 4.8.5-44)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> exit()
[root@localhost ~]# pip -V
pip 8.1.2 from /usr/lib/python2.7/site-packages (python 2.7)

5.编写docker-compose.yam文件

version: "5"
services:
  db:
    image: postgres:9.4
    volumes:
      - db-data:/var/lib/postgresql/data
    networks:
      - backend
    deploy:
      placement:
        constraints: [node.role == manager]

networks:
  frontend:
  backend:

volumes:
  db-data:
[root@localhost dhome]# docker-compose -f docker-compose.yml up -d
[+] Running 13/15
 ⠏ db 14 layers [⣿⣿⣿⣿⣿⣿⣿⣿⣷⣿⣿⣿⣿⣿] 49.44MB/53.62MB Pulling                                                                                                                                                 20.0s
   ✔ 619014d83c02 Pull complete                                                                                                                                                                           5.3s
   ✔ 7ec0fe6664f6 Pull complete                                                                                                                                                                           3.3s
   ✔ 9ca7ba8f7764 Pull complete                                                                                                                                                                           1.3s
   ✔ 9e1155d037e2 Pull complete                                                                                                                                                                           3.7s
   ✔ febcfb7f8870 Pull complete                                                                                                                                                                           7.1s
   ✔ 8c78c79412b5 Pull complete                                                                                                                                                                           5.5s
   ✔ 5a35744405c5 Pull complete                                                                                                                                                                           6.6s
   ✔ 27717922e067 Pull complete                                                                                                                                                                           6.8s
   ⠼ 36f0c5255550 Downloading     [==============================================>    ]  49.44MB/53.62MB                                                                                                 16.5s
   ✔ dbf0a396f422 Download complete                                                                                                                                                                       8.1s
   ✔ ec4c06ea33e5 Download complete                                                                                                                                                                       8.5s
   ✔ e8dd33eba6d1 Download complete                                                                                                                                                                       9.7s
   ✔ 51c81b3b2c20 Download complete                                                                                                                                                                       9.7s
   ✔ 2a03dd76f5d7 Download complete                                                                                                                                                                      11.0s

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:http://www.coloradmin.cn/o/1851389.html

如若内容造成侵权/违法违规/事实不符,请联系多彩编程网进行投诉反馈,一经查实,立即删除!

相关文章

STM32硬件接口I2C应用(基于FT6336)

目录 概述 1 硬件介绍 1.1 ST7796-LCD 1.2 MCU IO与LCD PIN对应关系 1.3 MCU IO与Touch PIN对应关系 2 FT6336的寄存器 2.1 FT6336寄存器列表 2.2 寄存器功能介绍 3 STM32Cube控制配置I2C 3.1 软硬件版本信息 3.2 I2C参数配置 3.3 使用STM32Cube产生工程 4 HAL库…

深入了解RTMP推流技术:视频汇聚EasyCVR低延迟与高稳定性分析

RTMP&#xff08;Real Time Messaging Protocol&#xff09;视频推流技术&#xff0c;作为音视频传输领域的关键技术之一&#xff0c;已经在直播、视频会议、在线教育等多个场景中得到了广泛应用。RTMP以其独特的优势&#xff0c;为实时音视频传输提供了高效、稳定的解决方案。…

前端路线指导(4):前端春招秋招经验分享

春招/秋招经验分享(前端) 哈喽大家好&#xff0c;我是小粉&#xff0c;双一流本科&#xff0c;自学前端一年&#xff0c;收获腾讯&#xff0c;字节等多家大厂offer&#xff0c;一半以上ssp~ 今天给大家分享一下我的春招&#xff08;暑期实习&#xff09;、秋招经历&#xff0c;…

咖啡事故,上海Manner咖啡店,1天两起店员和顾客发生冲突

上海咖啡店Manner&#xff0c;一天的时间竟然发生两起店员和员工发生肢体冲突&#xff1a; 事情详情&#xff1a; Manner威海路716店事件: 店员泼顾客咖啡粉&#xff0c;随后被辞退品牌方回应媒体&#xff0c;表示将严肃处理Manner梅花路门店事件:顾客因等待时间长抱怨&…

Docker部署MySQL8.3.0(保姆级图文教程)

系列文章目录 Docker部署Nginx1.21.5&#xff08;保姆级图文教程&#xff09; Docker部署MySQL8.3.0&#xff08;保姆级图文教程&#xff09; 文章目录 一、环境二、拉取镜像2.1 查找 Docker Hub 上的 MySQL 镜像2.2 拉取MySQL镜像2.3 查看MySQL镜像 三、在宿主机创建目录3.1 创…

查看LabVIEW及各个模块和驱动的版本号

要方便地查看当前计算机上安装的LabVIEW版本以及各个模块和驱动的版本号&#xff0c;可以使用以下几种方法&#xff1a; 1. 使用NI MAX (Measurement & Automation Explorer) NI MAX 是一个强大的工具&#xff0c;可以帮助你管理National Instruments硬件、软件和驱动程序…

5G/4G/北斗遥测终端机全国各省水利平台无缝对接

物联网技术的广泛应用正在深刻影响水利行业&#xff0c;计讯物联致力于推动水利技术的持续革新和服务的持续升级&#xff0c;依托国家级专业水利资质认证&#xff0c;在多个大型水利项目中展现的项目管理专长&#xff0c;为水利项目建设提供了高效的解决方案&#xff0c;持续推…

通用大模型的低代码平台——3分钟内快速搭建一个邮件提醒工具

文章目录 ⭐前言⭐node-koa开发一个发送邮件的api⭐百度智能云控制面板&#x1f496; 发送邮件的组件配置&#x1f496; 配置应用发布 ⭐总结⭐结束 ⭐前言 大家好&#xff0c;我是yma16&#xff0c;通用大模型的低代码平台——3分钟内快速搭建一个智能股票分析邮件提醒工具。…

OpenCV Mat实现图像四则运算及常用四则运算的API函数

装载有图像数据的OpenCV Mat对象&#xff0c;可以说是一个图像矩阵&#xff0c;可以进行加、减、乘、除运算。特别是加运算特别有用。 一 与常数的四则运算 与常数的加运算 示例&#xff1a; #include <iostream> #include <opencv2/opencv.hpp>using namespace …

Google Adsense----Wordpress插入谷歌广告

1.搭建个人博客,绑定谷歌search consol,注册adsense 详细可以参考这个视频b站视频 2.将个人博客网站关联到Adsense 在adsense里新加网站,输入你的博客网址,双击网站 将这段代码复制到header.php的里面 在wordpress仪表盘的外观-主题文件编辑器,找到header.php将代码复制,…

有玩家在2011年的MacBook上成功运行了Windows XP 还安装了触摸屏

我们已经在许多不同的设备上看到过 Windows XP 正在运行。这个古老的操作系统于 2001 年正式推出&#xff0c;现在已经老到其最后一次软件更新是在近十年前。一位好奇的玩家试图在 2011 年的触摸屏 MacBook 上为 Windows XP 打造了一个新家&#xff0c;复古技术探索者 Michael …

vmware虚拟机安装ubuntu20.04

1.下载Ubuntu 20.04的ISO镜像 Index of /ubuntu-releases/ 2.安装VMware 3.创建新的虚拟机&#xff1a;打开VMware&#xff0c;选择“创建新的虚拟机”或通过文件菜单新建虚拟机。 4.选择典型&#xff0c;然点点击下一步&#xff1a; 5.选择稍后安装操作系统&#xff1a; 6.…

LLC开关电源开发:第四节,LLC软件设计报告

LLC源代码链接 数控全桥LLC开发板软件设计报告  1. LLC硬件及软件框架2. LLC软件设计2.1 工程文件说明2.2 LLC中断设计2.2.1 20us中断2.2.2 5ms中断 2.3 LLC状态机设计2.3.1 初始化状态2.3.2 空闲状态2.3.3 软启动状态2.3.4 正常运行状态2.3.5 故障状态 2.4 环路设计2.4.1 环路…

1095 解码PAT准考证(测试点3)

solution 测试点3超时&#xff1a;命令为3时&#xff0c;用unordered_map而非map&#xff0c;否则会超时 #include<iostream> #include<string> #include<algorithm> #include<unordered_map> using namespace std; const int maxn 1e4 10; struct…

实战|YOLOv10 自定义目标检测

引言 YOLOv10[1] 概述和使用自定义数据训练模型 概述 由清华大学的研究团队基于 Ultralytics Python 包研发的 YOLOv10&#xff0c;通过优化模型结构并去除非极大值抑制&#xff08;NMS&#xff09;环节&#xff0c;提出了一种创新的实时目标检测技术。这些改进不仅实现了行业领…

Appium + Python App自动化第一个脚本

今天跟大家讲解一个Appium和Python App自动化的脚本。 【1】打开你的夜神模拟器&#xff08;或者连接你的手机&#xff09; 【2】打开桌面的Appium 【3】下载你要测的App的apk文件&#xff0c;放到桌面 【4】拖动你的apk安装包到夜神模拟器里&#xff0c;然后模拟器会提示你…

pyinstaller, cx_Freeze打包 pyqt 桌面应用-实操

1 pyinstaller 打包成 exe 参考这个连接&#xff0c; 写的比较全面&#xff1a; https://blog.csdn.net/qq_48979387/article/details/132359366 唯一发现一个错误是增加资源文件时候的分隔符(-add-data SOURCE:DEST)&#xff0c; 按照自己环境的实际的情况来&#xff1a; $…

CS162 Operating System-lecture2

A tread is suspended or no longer executing when its state’s not loaded in registers the point states is pointed at some other thread .so the thread that’s suspended is actually siting in memory and not yet executing or not executing at all with some thi…

探索Linux的奇妙世界:第二关---Linux的基本指令1

1. xshell与服务器的连接 想必大家在看过上一期视频时已经搭建好了Linux的环境了并且已经下好了终端---xshell了吧?让我来带大家看一看下好了是什么样子的: 第一次登陆会让你连接你的服务器,就是我们买的云服务器,买完之后需要把公网地址ip复制过来进行链接,需要用户名和密码连…