Fedora安装docker

news2025/1/7 5:10:25

Install Docker Engine on Fedora https://docs.docker.com/engine/install/fedora/

  1. 更新系统

首先,更新你的系统以确保所有软件包都是最新的:

sudo dnf update -y
  1. 安装必要的依赖

安装一些必要的工具和库,如yum-utils,这将帮助我们添加Docker的官方仓库:

sudo dnf install -y yum-utils
  1. 添加Docker的官方仓库

接下来,设置稳定版的Docker仓库:

sudo yum-config-manager --add-repo https://download.docker.com/linux/fedora/docker-ce.repo
  1. 安装Docker Engine

现在可以从Docker的仓库中安装Docker引擎:

sudo dnf install docker-ce docker-ce-cli containerd.io
  1. 启动并启用Docker服务

安装完成后,启动Docker守护进程,并设置为开机自启:

sudo systemctl start docker
sudo systemctl enable docker

可写为:

sudo systemctl enable --now docker
  1. 验证安装

最后,验证Docker是否正确安装并运行:

sudo docker run hello-world

如果一切正常,你应该会看到一条消息,说明Docker成功安装并且可以正常工作。

  1. (可选) 管理Docker作为非root用户

如果你不想每次运行Docker命令时都使用sudo,你可以将你的用户添加到docker组中:

sudo usermod -aG docker $USER

然后注销并重新登录,使新的组成员身份生效。







docker.com官网的 Fedora41,40 安装docker

sudo dnf remove docker \
                  docker-client \
                  docker-client-latest \
                  docker-common \
                  docker-latest \
                  docker-latest-logrotate \
                  docker-logrotate \
                  docker-selinux \
                  docker-engine-selinux \
                  docker-engine

sudo dnf -y install dnf-plugins-core
sudo dnf-3 config-manager --add-repo https://download.docker.com/linux/fedora/docker-ce.repo

sudo dnf install docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin

sudo systemctl enable --now docker

https://docs.docker.com/engine/install/fedora/ 2024年12月时的内容

Install Docker Engine on Fedora

To get started with Docker Engine on Fedora, make sure you meet the prerequisites, and then follow the installation steps.

Prerequisites

OS requirements
To install Docker Engine, you need a maintained version of one of the following Fedora versions:

  • Fedora 40
  • Fedora 41

Uninstall old versions
Before you can install Docker Engine, you need to uninstall any conflicting packages.

Your Linux distribution may provide unofficial Docker packages, which may conflict with the official packages provided by Docker. You must uninstall these packages before you install the official version of Docker Engine.

 sudo dnf remove docker \
                  docker-client \
                  docker-client-latest \
                  docker-common \
                  docker-latest \
                  docker-latest-logrotate \
                  docker-logrotate \
                  docker-selinux \
                  docker-engine-selinux \
                  docker-engine

dnf might report that you have none of these packages installed.

Images, containers, volumes, and networks stored in /var/lib/docker/ aren’t automatically removed when you uninstall Docker.

Installation methods
  • You can install Docker Engine in different ways, depending on your needs:

  • You can set up Docker’s repositories and install from them, for ease of installation and upgrade tasks. This is the recommended approach.

  • You can download the RPM package, install it manually, and manage upgrades completely manually. This is useful in situations such as installing Docker on air-gapped systems with no access to the internet.

In testing and development environments, you can use automated convenience scripts to install Docker.

Install using the rpm repository
Before you install Docker Engine for the first time on a new host machine, you need to set up the Docker repository. Afterward, you can install and update Docker from the repository.

Set up the repository
Install the dnf-plugins-core package (which provides the commands to manage your DNF repositories) and set up the repository.

 sudo dnf -y install dnf-plugins-core
 sudo dnf-3 config-manager --add-repo https://download.docker.com/linux/fedora/docker-ce.repo

Install Docker Engine

  1. Install the Docker packages.

Latest Specific version
To install the latest version, run:

 sudo dnf install docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin

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.

This command installs Docker, but it doesn’t start Docker. It also creates a docker group, however, it doesn’t add any users to the group by default.

  1. Start Docker Engine.
 sudo systemctl enable --now docker

This configures the Docker systemd service to start automatically when you boot your system. If you don’t want Docker to start automatically, use sudo systemctl start docker instead.

  1. Verify that the installation is successful by running the hello-world image:
 sudo docker run hello-world

This command downloads a test image and runs it in a container. When the container runs, it prints a confirmation message and exits.

You have now successfully installed and started Docker Engine.

Tip

Receiving errors when trying to run without root?

The docker user group exists but contains no users, which is why you’re required to use sudo to run Docker commands. Continue to Linux postinstall to allow non-privileged users to run Docker commands and for other optional configuration steps.

Upgrade Docker Engine
To upgrade Docker Engine, follow the installation instructions, choosing the new version you want to install.

Install from a package
If you can’t use Docker’s rpm repository to install Docker Engine, you can download the .rpm file for your release and install it manually. You need to download a new file each time you want to upgrade Docker Engine.

  1. Go to https://download.docker.com/linux/fedora/ and choose your version of Fedora. Then browse to x86_64/stable/Packages/ and download the .rpm file for the Docker version you want to install.

  2. Install Docker Engine, changing the following path to the path where you downloaded the Docker package.

 sudo dnf install /path/to/package.rpm

Docker is installed but not started. The docker group is created, but no users are added to the group.

  1. Start Docker Engine.
 sudo systemctl enable --now docker

This configures the Docker systemd service to start automatically when you boot your system. If you don’t want Docker to start automatically, use sudo systemctl start docker instead.

  1. Verify that the installation is successful by running the hello-world image:
 sudo docker run hello-world

This command downloads a test image and runs it in a container. When the container runs, it prints a confirmation message and exits.

You have now successfully installed and started Docker Engine.

Tip

Receiving errors when trying to run without root?

The docker user group exists but contains no users, which is why you’re required to use sudo to run Docker commands. Continue to Linux postinstall to allow non-privileged users to run Docker commands and for other optional configuration steps.

Upgrade Docker Engine
To upgrade Docker Engine, download the newer package files and repeat the installation procedure, using dnf upgrade instead of dnf install, and point to the new files.

Install using the convenience script
Docker provides a convenience script at https://get.docker.com/ to install Docker into development environments non-interactively. The convenience script isn’t recommended for production environments, but it’s useful for creating a provisioning script tailored to your needs. Also refer to the install using the repository steps to learn about installation steps to install using the package repository. The source code for the script is open source, and you can find it in the docker-install repository on GitHub.

Always examine scripts downloaded from the internet before running them locally. Before installing, make yourself familiar with potential risks and limitations of the convenience script:

  • The script requires root or sudo privileges to run.
  • The script attempts to detect your Linux distribution and version and configure your package management system for you.
  • The script doesn’t allow you to customize most installation parameters.
  • The script installs dependencies and recommendations without asking for confirmation. This may install a large number of packages, depending on the current configuration of your host machine.
  • By default, the script installs the latest stable release of Docker, containerd, and runc. When using this script to provision a machine, this may result in unexpected major version upgrades of Docker. Always test upgrades in a test environment before deploying to your production systems.
  • The script isn’t designed to upgrade an existing Docker installation. When using the script to update an existing installation, dependencies may not be updated to the expected version, resulting in outdated versions.
    Tip

Preview script steps before running. You can run the script with the --dry-run option to learn what steps the script will run when invoked:

 curl -fsSL https://get.docker.com -o get-docker.sh
 sudo sh ./get-docker.sh --dry-run

This example downloads the script from https://get.docker.com/ and runs it to install the latest stable release of Docker on Linux:

 curl -fsSL https://get.docker.com -o get-docker.sh
 sudo sh get-docker.sh
Executing docker install script, commit: 7cae5f8b0decc17d6571f9f52eb840fbc13b2737
<...>

You have now successfully installed and started Docker Engine. The docker service starts automatically on Debian based distributions. On RPM based distributions, such as CentOS, Fedora, RHEL or SLES, you need to start it manually using the appropriate systemctl or service command. As the message indicates, non-root users can’t run Docker commands by default.

Use Docker as a non-privileged user, or install in rootless mode?

The installation script requires root or sudo privileges to install
and use Docker. If you want to grant non-root users access to Docker,
refer to the post-installation steps for Linux. You can also install
Docker without root privileges, or configured to run in rootless mode.
For instructions on running Docker in rootless mode, refer to run the
Docker daemon as a non-root user (rootless mode).

Install pre-releases
Docker also provides a convenience script at https://test.docker.com/ to install pre-releases of Docker on Linux. This script is equal to the script at get.docker.com, but configures your package manager to use the test channel of the Docker package repository. The test channel includes both stable and pre-releases (beta versions, release-candidates) of Docker. Use this script to get early access to new releases, and to evaluate them in a testing environment before they’re released as stable.

To install the latest version of Docker on Linux from the test channel, run:

 curl -fsSL https://test.docker.com -o test-docker.sh
 sudo sh test-docker.sh

Upgrade Docker after using the convenience script
If you installed Docker using the convenience script, you should upgrade Docker using your package manager directly. There’s no advantage to re-running the convenience script. Re-running it can cause issues if it attempts to re-install repositories which already exist on the host machine.

Uninstall Docker Engine

  1. Uninstall the Docker Engine, CLI, containerd, and Docker Compose packages:
 sudo dnf remove docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin docker-ce-rootless-extras
  1. Images, containers, volumes, or custom configuration files on your host aren’t automatically removed. To delete all images, containers, and volumes:
 sudo rm -rf /var/lib/docker
 sudo rm -rf /var/lib/containerd

You have to delete any edited configuration files manually.





































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

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

相关文章

活动预告 | Microsoft Power Platform 在线技术公开课:实现业务流程自动化

课程介绍 参加“Microsoft Power Platform 在线技术公开课&#xff1a;实现业务流程自动化”活动&#xff0c;了解如何更高效地开展业务。参加我们举办的本次免费培训活动&#xff0c;了解如何借助 Microsoft AI Builder 和 Power Automate 优化工作流。结合使用这些工具可以帮…

【SpringBoot教程】搭建SpringBoot项目之编写pom.xml

&#x1f64b;大家好&#xff01;我是毛毛张! &#x1f308;个人首页&#xff1a; 神马都会亿点点的毛毛张 &#x1f44f;今天毛毛张分享的内容主要是Maven 中 pom 文件&#x1f195;&#xff0c;涵盖基本概念、标签属性、配置等内容 文章目录 1.前言&#x1f96d;2.项目基本…

职场常用Excel基础04-二维表转换

大家好&#xff0c;今天和大家一起分享一下excel的二维表转换相关内容~ 在Excel中&#xff0c;二维表&#xff08;也称为矩阵或表格&#xff09;是一种组织数据的方式&#xff0c;其中数据按照行和列的格式进行排列。然而&#xff0c;在实际的数据分析过程中&#xff0c;我们常…

ASA第六天笔记

Botnet Traffic Filter简介 1.僵死网络流量过滤特性是一个基于名誉的机制&#xff0c;用于阻止流量源自于或者去往已知的感染主机。 2.僵死网络流量过滤比较每一个连接中的源和目的IP地址。 动态SensorBase数据库&#xff0c;被Cisco动态更新。静态数据库&#xff0c;需要手动…

【ArcGISPro/GeoScenePro】检查多光谱影像的属性并优化其外观

数据 https://arcgis.com/sharing/rest/content/items/535efce0e3a04c8790ed7cc7ea96d02d/data 操作 其他数据 检查影像的属性 熟悉检查您正在使用的栅格属性非常重要。

MySQL图形化界面工具--DataGrip

之前介绍了在命令行进行操作&#xff0c;但是不够直观&#xff0c;本次介绍图形化界面工具–DataGrip。 安装DataGrip 官网链接&#xff1a;官网下载链接 常规的软件安装流程。 参考链接&#xff1a;DataGrip安装 使用DataGrip 添加数据源&#xff1a; 第一次使用最下面会…

企业微信——智能表格学习

智能表格 应用限制条件 获取 token https://developer.work.weixin.qq.com/document/10013#%E5%BC%80%E5%8F%91%E6%AD%A5%E9%AA%A4 开发步骤 你可以通过以下步骤&#xff0c;使用access_token来访问企业微信的接口。需要注意的是&#xff0c;所有的接口需使用Https协议、Js…

调试:用电脑开发移动端网页,然后用手机真机调试

一、背景 电脑开发移动端&#xff0c;然后想真机调试... 二、实现 2.1、电脑和手机链接相同局域网 2.2、pnpm run dev 启动项目 2.3、浏览器访问 localhost:3001/login 2.4、Windowsr 输入cmd&#xff0c;在cmd输入 ipconfig 2.5、浏览器访问 ip地址加/login 2.6、手机端…

华为ensp-BGP路由过滤

学习新思想&#xff0c;争做新青年&#xff0c;今天学习的是BGP路由过滤 实验目的&#xff1a; 掌握利用BGP路由属性AS_Path进行路由过滤的方法 掌握利用BGP路由属性Community进行路由过滤的方法 掌握利用BGP路由属性Next_Hop进行路由过滤的方法 实验内容&#xff1a; 本实…

【书籍连载】《软件测试架构实践与精准测试》| 有关软件测试模型的调查结果

各位软件领域的精英们&#xff0c;今天小编邀请你继续深入学习《软件测试架构实践与精准测试》。 《软件测试架构实践与精准测试》是作者李龙&#xff08;安畅检测首席技术专家&#xff09;基于软件测试“川模型”的著作。本书结合作者首次提出的软件测试新的模型“川模型”测试…

nginx学习之路-windows系统安装nginx

文章目录 1. 下载2. 启动3. 验证参考文档 1. 下载 官方下载地址&#xff1a;https://nginx.org/en/download.html 可以下载windows版本&#xff0c;如nginx-1.26.2.zip。解压后&#xff0c;加入系统变量。 2. 启动 可以使用命令行启动&#xff08;windows系统自带的cmd可能…

word中编号统一格式

不要手敲编号&#xff0c;要利用工具来。要善于利用多级编号和编号&#xff0c;分别对标题和段落进行组织 尤其是段落和标题特别多的时候&#xff0c;像毕设、标书这些 为什么呢&#xff1f;因为这样更方便修改&#xff0c;后续的增加和删除段落&#xff0c;编号会自动排列&am…

MQ-导读

什么是MQ&#xff1f; MQ是一款消息中间件&#xff0c;通常被称为"消息队列",用于分布式架构中上下文的异步通信&#xff0c; 由三个角色组成&#xff1a; 1. 消息提供者&#xff1a;发送消息的人 2. 消息接收者&#xff1a;接收、处理消息的人 3. 消息代理者&#x…

深入剖析MySQL数据库架构:核心组件、存储引擎与优化策略(四)

慢查询日志&#xff0c;顾名思义&#xff0c;就是查询慢的日志&#xff0c;是指mysql记录所有执行超过long_query_time&#xff08;默认的时间10秒&#xff09;参数设定的时间阈值的SQL语句的日志。该日志能为SQL语句的优化带来很好的帮助。默认情况下&#xff0c;慢查询日志是…

MySQL数据库笔记——版本号机制和CAS(Compare And Swap)

大家好&#xff0c;这里是Good Note&#xff0c;关注 公主号&#xff1a;Goodnote&#xff0c;本文详细介绍乐观锁的两种实现方式&#xff1a;版本号机制和CAS&#xff08;Compare And Swap&#xff09;。 文章目录 MySQL 内置的并发控制机制MVCC&#xff08;多版本并发控制&am…

使用 commitlint 和 husky 检查提交描述是否符合规范要求

在上一小节中&#xff0c;我们了解了 Git hooks 的概念&#xff0c;那么接下来我们就使用 Git hooks 来去校验我们的提交信息。 要完成这么个目标&#xff0c;那么我们需要使用两个工具&#xff1a; 注意&#xff1a;npm 需要在 7.x 以上版本。 1. commitlint 用于检查提交信…

使用函数求e的近似值(PTA)C语言

自然常数e可以用级数11/1!1/2!⋯1/n!来近似计算。本题要求实现一个计算阶乘的简单函数&#xff0c;使得可以利用该函数&#xff0c;对给定的非负整数n&#xff0c;求该级数的前n1项和。 函数接口定义&#xff1a; double fact( int n ); 其中n是用户传入的参数&#xff0c;函…

使用Clion在ubuntu上进行交叉编译,并在Linux上远程编译五子棋

目录 1.工具以及概念介绍 &#xff08;1&#xff09;Clion软件简介 &#xff08;2&#xff09;交叉编译 &#xff08;3&#xff09;远程编译 2.操作原理 3.详细操作步骤 &#xff08;1&#xff09;配置Clion与虚拟机ubuntu的ssh连接 CLion远程开发Ubuntu&#xff0c;并显…

ubuntu如何禁用 Snap 更新

.禁用 Snap 更新&#xff08;通过修改 snapd 配置&#xff09; 打开并编辑 /etc/apt/apt.conf.d/50unattended-upgrades文件。 这个文件控制自动更新的行为。 sudo vim /etc/apt/apt.conf.d/50unattended-upgrades 里面有一行将里面的auto改为false即可禁用更新&#xff1a;…

SpringBoot - Spring Profiles 详解

文章目录 Pre官方文档Spring Profiles 详解1. 基本用法2. 激活 Profiles3. 添加 Active Profiles4. Profile Groups5. 在代码中设置 Profiles6. Profile 特定的配置文件 总结 Pre SpringBoot - Spring Boot 中的配置体系Profile全面解读 SpringBoot - spring.profiles.active…