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

相关推荐
凯子坚持 c1 小时前
深入Linux权限体系:守护系统安全的第一道防线
linux·运维·系统安全
大熊程序猿1 小时前
K8s证书过期
云原生·容器·kubernetes
摸鱼也很难4 小时前
Docker 镜像加速和配置的分享 && 云服务器搭建beef-xss
运维·docker·容器
woshilys4 小时前
sql server 查询对象的修改时间
运维·数据库·sqlserver
疯狂飙车的蜗牛5 小时前
从零玩转CanMV-K230(4)-小核Linux驱动开发参考
linux·运维·驱动开发
恩爸编程6 小时前
探索 Nginx:Web 世界的幕后英雄
运维·nginx·nginx反向代理·nginx是什么·nginx静态资源服务器·nginx服务器·nginx解决哪些问题
鸠摩智首席音效师7 小时前
Docker 中如何限制CPU和内存的使用 ?
docker·容器
Michaelwubo7 小时前
Docker dockerfile镜像编码 centos7
运维·docker·容器
jingyu飞鸟7 小时前
centos-stream9系统安装docker
linux·docker·centos
好像是个likun7 小时前
使用docker拉取镜像很慢或者总是超时的问题
运维·docker·容器