在fedora 36 上安装docker
1、安装
dnf install docker
将会安装moby-engine,containerd, runc
(1)moby-engine
Moby is an open framework created by Docker to assemble specialized container systems without reinventing the wheel. It provides a “lego set” of dozens of standard components and a framework for assembling them into custom platforms.
容器组建装配
https://mobyproject.org/
(2)containerd
An industry-standard container runtime with an emphasis on simplicity, robustness and portability.
容器运行框架
https://containerd.io/
(3)runc
runc
is a CLI tool for spawning and running containers on Linux according to the Open Container Initiative (OCI) specification
容器命令行工具https://github.com/opencontainers/runc
2.启动docker
systemctl start dockersystemctl enable docker
3.配置docker image mirror
国内镜像
Docker中国区官方 | https://registry.docker-cn.com |
/etc/docker/daemon.json{"registry-mirrors": ["https://registry.docker-cn.com"]
}
重新加载配置
systemctl daemon-reloadsystemctl restart docker
in root-less mode
systemctl --user daemon-reloadsystemctl --user restart docker
配置代理
/etc/systemd/system/docker.service.d/proxy.conf
[Service]
Environment="HTTP_PROXY=socks5://127.0.0.1:8080"
Environment="HTTPS_PROXY=socks5://127.0.0.1:8080"
Pulling Docker images via a SOCKS5 proxy | Mark van Lent’s weblog
4.拉取镜像
docker pull nginx
查看已经下载镜像:docker images
仓库中查找镜像:docker search mysql
下载到本地镜像位置:
仓库文件:/var/lib/docker/image/btrfs/repositories.json
root@fedora btrfs]# cat repositories.json
{"Repositories":{"mysql":{"mysql:latest":"sha256:43fcfca0776df8e192d1647da2866237fbd9f8e875fb496e4ca887369b2dd995","mysql@sha256:b9532b1edea72b6cee12d9f5a78547bd3812ea5db842566e17f8b33291ed2921":"sha256:43fcfca0776df8e192d1647da2866237fbd9f8e875fb496e4ca887369b2dd995"},"nginx":{"nginx:latest":"sha256:51086ed63d8cba3a6a3d94ecd103e9638b4cb8533bb896caf2cda04fb79b862f","nginx@sha256:2f770d2fe27bc85f68fd7fe6a63900ef7076bc703022fe81b980377fe3d27b70":"sha256:51086ed63d8cba3a6a3d94ecd103e9638b4cb8533bb896caf2cda04fb79b862f"}}}[root@fedora btrfs]#
配置文件:
cat ./imagedb/content/sha256/43fcfca0776df8e192d1647da2866237fbd9f8e875fb496e4ca887369b2dd995
{"architecture":"amd64","config":{"Hostname":"","Domainname":"","User":"","AttachStdin":false,"AttachStdout":false,"AttachStderr":false,"ExposedPorts":{"3306/tcp":{},"33060/tcp":{}},"Tty":false,"OpenStdin":false,"StdinOnce":false,"Env":["PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin","GOSU_VERSION=1.14","MYSQL_MAJOR=8.0","MYSQL_VERSION=8.0.30-1.el8","MYSQL_SHELL_VERSION=8.0.30-1.el8"],"Cmd":["mysqld"],"Image":"sha256:f52f23539714a3abec9e16dde727b7296a14405390609ffe82346ba5bcf7a826","Volumes":{"/var/lib/mysql":{}},"WorkingDir":"","Entrypoint":["docker-entrypoint.sh"],"OnBuild":null,"Labels":null},"container":"92850d44628fa3be3553a902e1297eb0dc5ccdd73f5e3b2e1ce4b2dfddf6ad43","container_config":{"Hostname":"92850d44628f","Domainname":"","User":"","AttachStdin":false,"AttachStdout":false,"AttachStderr":false,"ExposedPorts":{"3306/tcp":{},"33060/tcp":{}},"Tty":false,"OpenStdin":false,"StdinOnce":false,"Env":["PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin","GOSU_VERSION=1.14","MYSQL_MAJOR=8.0","MYSQL_VERSION=8.0.30-1.el8","MYSQL_SHELL_VERSION=8.0.30-1.el8"],"Cmd":["/bin/sh","-c","#(nop) ","CMD [\"mysqld\"]"],"Image":"sha256:f52f23539714a3abec9e16dde727b7296a14405390609ffe82346ba5bcf7a826","Volumes":{"/var/lib/mysql":{}},"WorkingDir":"","Entrypoint":["docker-entrypoint.sh"],"OnBuild":null,"Labels":{}},"created":"2022-09-14T21:46:31.123894498Z","docker_version":"20.10.12","history":[],"os":"linux","rootfs":{"type":"layers","diff_ids":["sha256:05dc728e5e49b5db657ec403b875f757afdd8d31f624eea76d706d6eee6395b2","sha256:e413712982712f9b6795a558563749f8b9413af078f02290a8b132df58d93587","sha256:3efed8ece3f742cea267c6097b6ef1f5beb34d431da0404797b817bcd228e15b","sha256:5bd7288fc71b94c6b6a0fe48881a23c18924c59b419328b1e0516c289406c56d","sha256:089c3ce0a7bd0ec7d0146ee50cf1f6a0762a2bf37c6d52a1b391e1058fe6325a","sha256:548aa849c503d8ec7bb942c9cfb217499c1c68b5c974aa6daa6d6e9ab0ccef85","sha256:390f3d47b221eb0b0d435bd5deca0d228a2becc69e8b638755205bdde6ce9d8f","sha256:ae26f7a91c57484862161f9d36ea6a09c94252a32a7163ac9b8dfa7d3e1bda45","sha256:6a6f178837b4195dba9daf066f5bec032a75a2597a341972c961a4bb2ede9055","sha256:80411d0a9f6fb5bea4177979c8d04ff1b6a7a22d24cba2465cb2e61cc6916a64","sha256:1ee6afb508377ecb9d9a003fff84b132d023b0bd7b779092fdd5a1785a0b513b"]}}
5.启动容器
docker run -d -p 80:80 nginx
-d - Run the container in detached mode (in the background).
-p 80:80 - Map port 80 of the host to port 80 in the container. To access the tutorial, open a web browser and navigate to http://localhost:80. If you already have a service listening on port 80 on your host machine, you can specify another port. For example, specify -p 3000:80 and then access the tutorial via a web browser at http://localhost:3000.
docker container list
or
docker ps
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
81936be29837 nginx "/docker-entrypoint.…" 7 minutes ago Up 7 minutes 0.0.0.0:80->80/tcp, :::80->80/tcp compassionate_robinson
容器文件目录
/var/lib/docker/image/btrfs/layerdb/mounts56e77873db4201b67a8ee1afc2ddf14645998e34bf95eb50bd8dc9074636183emount-id to/var/lib/docker/btrfs/subvolumes/592c474917fc284c21bbcb9e8eade68d5a9e977132464289195de282007ac404
6.登陆容器
docker exec -it container_id /bin/bash-i, --interactive Keep STDIN open even if not attached
-t, --tty Allocate a pseudo-TTY
7.停止容器
docker stop 81936be29837
docker stop container-id
8.文件COPY入COPY出
docker cp 81936be29837:/etc/nginx/nginx.conf nginx.confdocker cp nginx.conf 81936be29837:/etc/nginx/nginx.conf
9.为普通用户增加生成镜像权限
usermod -G docker user_name
su - user_name 或重新登陆
在fedora 36 上安装docker相关推荐
- docker显示linux桌面,怎样在桌面上安装 Docker CE?
按照这些简单的步骤在你的 Linux.Mac 或 Windows 桌面上安装 Docker CE. 在上一篇文章中,我们学习了容器世界的一些基本术语.当我们运行命令并在后续文章中使用其中一些术语时,这 ...
- 在CentOS 7上安装Docker
文章目录 一.安装简介 二.在CentOS 7上安装Docker常用命令 三.执行过程: 1.卸载旧版本 2.安装依赖包 3.安装Docker 四.一键安装Docker 一.安装简介 Docker 运 ...
- debian上安装docker ce
在Debian9上安装Docker CE 使用从包中安装的方式 Docker是一个开源的容器引擎,它有助于更快地交付产品. Docker可将应用程序和基础设施层隔离,并且将基础设施当作程序一样进行管理 ...
- ubuntu上安装docker
在Ubuntu16.04上安装Docker Docker是一个开源的容器引擎,它有助于更快地交付产品. Docker可将应用程序和基础设施层隔离,并且将基础设施当作程序一样进行管理. 使用Docker ...
- 在Windows上安装Docker
背景 Windows的Docker桌面是Microsoft Windows的Docker的社区版本.您可以从Docker Hub下载适用于Windows的Docker桌面.该页面包含有关在Window ...
- CentOS上安装Docker (图解)
更简单的办法:三分钟装好 Docker ( 图解) 前些天发现了一个巨牛的人工智能学习网站,通俗易懂,风趣幽默,忍不住分享一下给大家.点击跳转到教程. // 用上面那个办法吧,简单多了,下面这个方法看 ...
- docker兼容的linux内核,CentOS 6.5上安装Docker与Docker对中文字符集的支持
一.CentOS 6.5上安装docker 在CentOS 6.5 还不能够直接通过yum install -y docker 来安装docker服务,在一些文档中有看到说是因为内核太低的原因导致的, ...
- 阿里云cenos 6.5 模板上安装 docker
本章将介绍在阿里云的 Centos6.5 模板上安装 Docker 以及在 Ubuntu 14.04 模板上安装 Docker 的过程 Centos 6.5 模板上使用Docker 首先,通过 ssh ...
- 在Ubuntu上安装Docker –分步指南
Let me walk you through the steps to install docker on Ubuntu today. Since I was installing it on my ...
最新文章
- jquery Fancybox插件的应用
- python界面图片-python如何实现读取并显示图片(不需要图形界面)
- 网络慢是带宽不足?—Vecloud微云
- eureka hostname作用_SpringCloud基础教程(三)-Eureka进阶
- 项目交换成功——PM(李忠)
- SpringBoot Serverless 实战 | 监控调试
- 加密货币的寒冬如何破冰?
- JAVA课设——俄罗斯方块
- 手动保存刷新微星主板BIOS图解教程
- oppo9s刷机教程_OPPO R9s R9sk刷机教程 OPPO R9s R9sk卡刷升级教程
- NAS 层架构_01
- mysql链路追踪工具_Molten
- vue本页面跳转不刷新
- 2017四月TOP100电商类App排行榜出炉
- oralce函数大全
- 十三、Jmeter生成html报告
- 推荐12个开放式免费收录网站的分类目录
- iview+时间选择器+禁止选择事件
- 使用容器方式进行编译的经验和技巧小结
- 前言 Preface