docker部署

#将包导入,然后解压,安装

tar zxf docker.tar.gz

rpm -qa | grep runc

yum remove runc-1.1.0-2.el9.x86_64 #

dnf install *.rpm -y

#运行

[root@localhost ~]# systemctl enable --now docker

Created symlink /etc/systemd/system/multi-user.target.wants/docker.service → /usr/lib/systemd/system/docker.service.

#查看

[root@docker ~]# docker info

Client: Docker Engine - Community

Version: 27.1.2

Context: default

Debug Mode: false

Plugins:

buildx: Docker Buildx (Docker Inc.)

Version: v0.16.2

Path: /usr/libexec/docker/cli-plugins/docker-buildx

compose: Docker Compose (Docker Inc.)

Version: v2.29.1

Path: /usr/libexec/docker/cli-plugins/docker-compose

......

#初识镜像

[root@docker ~]# docker images

REPOSITORY TAG IMAGE ID CREATED SIZE

[root@docker ~]# docker pull busybox ##拉取镜像

阿里云,镜像加速器?

[root@docker docker]# vim daemon.json

[root@docker docker]# cat daemon.json

{

"registry-mirrors": ["https://sz947zpr.mirror.aliyuncs.com"]

}

[root@docker ~]# systemctl restart docker

[root@docker ~]# docker search nginx ##可以使用这个命令搜索

NAME DESCRIPTION STARS OFFICIAL

nginx Official build of Nginx. 20126 [OK]

nginx/nginx-quic-qns NGINX QUIC interop 1

nginx/nginx-ingress NGINX and NGINX Plus Ingress Controllers fo... 94

nginx/nginx-ingress-operator NGINX Ingress Operator for NGINX and NGINX P... 2

nginx/nginx-prometheus-exporter NGINX Prometheus Exporter for NGINX and NGIN... 43

#将本地下载的导入

[root@docker ~]# docker load -i game2048.tar.gz

011b303988d2: Loading layer [==================================================>] 5.05MB/5.05MB

36e9226e74f8: Loading layer [==================================================>] 51.46MB/51.46MB

192e9fad2abc: Loading layer [==================================================>] 3.584kB/3.584kB

6d7504772167: Loading layer [==================================================>] 4.608kB/4.608kB

88fca8ae768a: Loading layer [==================================================>] 629.8kB/629.8kB

Loaded image: timinglee/game2048:latest

[root@docker ~]# docker load -i mario.tar.gz

[root@docker ~]# docker load -i nginx-latest.tar.gz

[root@docker ~]# docker load -i busybox-latest.tar.gz

[root@docker ~]# docker images #查看镜像

REPOSITORY TAG IMAGE ID CREATED SIZE

nginx latest 5ef79149e0ec 13 days ago 188MB

busybox latest 65ad0d468eb1 15 months ago 4.26MB

timinglee/game2048 latest 19299002fdbe 7 years ago 55.5MB

timinglee/mario latest 9a35a9e43e8c 8 years ago 198MB

[root@docker ~]# docker run -d --rm --name webserver -p 80:80 nginx #运行容器

621074a73599f9ec4596c88d42377edad7c0a7024415556a1828b66ba2043988

[root@docker ~]# docker ps

CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES

621074a73599 nginx "/docker-entrypoint...." 29 seconds ago Up 28 seconds 0.0.0.0:80->80/tcp, :::80->80/tcp webserver

[root@docker ~]# docker rm -f webserver

webserver

[root@docker ~]# docker ps

CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES

[root@docker ~]#

[root@docker ~]# docker run -d --rm --name game1 -p 80:80 timinglee/game2048:latest

ebaa6f672eba033c75e935e48fcf5ce4bb2f023c400b9ccfb44420ded0f86406

[root@docker ~]# docker ps

CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES

ebaa6f672eba timinglee/game2048:latest "/bin/sh -c 'sed -i ..." About a minute ago Up About a minute 0.0.0.0:80->80/tcp, :::80->80/tcp, 443/tcp game1

[root@docker ~]# docker history timinglee/game2048:latest

IMAGE CREATED CREATED BY SIZE COMMENT

19299002fdbe 7 years ago /bin/sh -c #(nop) CMD ["/bin/sh" "-c" "sed ... 0B

<missing> 7 years ago /bin/sh -c #(nop) EXPOSE 80/tcp 0B

<missing> 7 years ago /bin/sh -c #(nop) COPY dir:cb74e9c037a3d501c... 600kB

<missing> 7 years ago /bin/sh -c #(nop) MAINTAINER Golfen Guo <go... 0B

<missing> 7 years ago /bin/sh -c #(nop) CMD ["nginx" "-g" "daemon... 0B

<missing> 7 years ago /bin/sh -c #(nop) EXPOSE 443/tcp 80/tcp 0B

<missing> 7 years ago /bin/sh -c #(nop) COPY file:d15ceb73c6ea776c... 1.1kB

<missing> 7 years ago /bin/sh -c #(nop) COPY file:af94db45bb7e4b8f... 643B

<missing> 7 years ago /bin/sh -c GPG_KEYS=B0F4253373F8F6F510D42178... 50.1MB

<missing> 7 years ago /bin/sh -c #(nop) ENV NGINX_VERSION=1.11.7 0B

<missing> 7 years ago /bin/sh -c #(nop) MAINTAINER NGINX Docker M... 0B

<missing> 7 years ago /bin/sh -c #(nop) ADD file:7afbc23fda8b0b387... 4.8MB

[root@docker ~]# docker rm -f game1

game1

[root@docker ~]# docker run -d --rm --name maliao -p 80:8080 timinglee/mario:latest

7060b40db90e9ed77ad8ebfa401518459d46c4066b8ea3443aaaf41f1a6ef60e

[root@docker ~]# docker ps

CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES

7060b40db90e timinglee/mario:latest "python3 -m http.ser..." 4 seconds ago Up 3 seconds 0.0.0.0:80->8080/tcp, :::80->8080/tcp maliao

相关推荐
东华果汁哥4 分钟前
【linux 免密登录】快速设置kafka01、kafka02、kafka03 三台机器免密登录
linux·运维·服务器
肖永威35 分钟前
CentOS环境上离线安装python3及相关包
linux·运维·机器学习·centos
Code_Artist38 分钟前
使用Portainer来管理并编排Docker容器
docker·云原生·容器
mengao123440 分钟前
centos 服务器 docker 使用代理
服务器·docker·centos
布鲁格若门42 分钟前
CentOS 7 桌面版安装 cuda 12.4
linux·运维·centos·cuda
Eternal-Student1 小时前
【docker 保存】将Docker镜像保存为一个离线的tar归档文件
运维·docker·容器
不是二师兄的八戒1 小时前
本地 PHP 和 Java 开发环境 Docker 化与配置开机自启
java·docker·php
dessler1 小时前
云计算&虚拟化-kvm-扩缩容cpu
linux·运维·云计算
DC_BLOG1 小时前
Linux-Apache静态资源
linux·运维·apache
码农小丘1 小时前
一篇保姆式centos/ubuntu安装docker
运维·docker·容器