- 镜像搜索
docker search nginx
NAME DESCRIPTION STARS OFFICIAL AUTOMATED
nginx Official build of Nginx. 11025 [OK]
jwilder/nginx-proxy Automated Nginx reverse proxy for docker con… 1550 [OK]
richarvey/nginx-php-fpm Container running Nginx + PHP-FPM capable of… 686 [OK]
jrcs/letsencrypt-nginx-proxy-companion LetsEncrypt container to use with nginx as p… 490 [OK]
webdevops/php-nginx Nginx with PHP-FPM 123 [OK]
kitematic/hello-world-nginx A light-weight nginx container that demonstr… 121
zabbix/zabbix-web-nginx-mysql Zabbix frontend based on Nginx web-server wi… 91 [OK]
bitnami/nginx Bitnami nginx Docker Image 63 [OK]
linuxserver/nginx An Nginx container, brought to you by LinuxS… 55
1and1internet/ubuntu-16-nginx-php-phpmyadmin-mysql-5 ubuntu-16-nginx-php-phpmyadmin-mysql-5 49 [OK]
tobi312/rpi-nginx NGINX on Raspberry Pi / armhf 24 [OK]
nginx/nginx-ingress NGINX Ingress Controller for Kubernetes 17
wodby/drupal-nginx Nginx for Drupal container image 12 [OK]
blacklabelops/nginx Dockerized Nginx Reverse Proxy Server. 12 [OK]
nginxdemos/hello NGINX webserver that serves a simple page co… 11 [OK]
schmunk42/nginx-redirect A very simple container to redirect HTTP tra… 11 [OK]
centos/nginx-18-centos7 Platform for running nginx 1.8 or building n… 10
centos/nginx-112-centos7 Platform for running nginx 1.12 or building … 7
nginxinc/nginx-unprivileged Unprivileged NGINX Dockerfiles 4
1science/nginx Nginx Docker images that include Consul Temp… 4 [OK]
mailu/nginx Mailu nginx frontend 3 [OK]
travix/nginx NGinx reverse proxy 2 [OK]
toccoag/openshift-nginx Nginx reverse proxy for Nice running on same… 1 [OK]
wodby/nginx Generic nginx 0 [OK]
ansibleplaybookbundle/nginx-apb An APB to deploy NGINX 0 [OK]
- 镜像载入
docker pull nginx
- 运行容器:
运行mysql容器
docker run --name mysql-5.6 -p 3306:3306 -e MYSQL_ROOT_PASSWORD=123456 -d mysql:5.6
- 查看正在运行的容器
docker ps
- 查看容器端口的映射情况
docker port 可以查看指定 (ID 或者名字)容器的某个确定端口映射到宿主机的端口号
- docker images 来列出本地主机上的镜像
docker images
REPOSITORY TAG IMAGE ID CREATED SIZE
ubuntu 15.10 9b9cb95443b5 2 years ago 137MB
training/webapp latest 6fae60ef3446 3 years ago 349MB
REPOSITORY:表示镜像的仓库源
TAG:镜像的标签
IMAGE ID:镜像ID
CREATED:镜像创建时间
SIZE:镜像大小
- 查看正在运行的容器
[root@JD redis]# docker ps
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
14ef1138d86b redis:3.2 "docker-entrypoint.s…" 15 minutes ago Up 15 minutes 0.0.0.0:6379->6379/tcp eager_murdock
3d11fb3ff308 tomcat "catalina.sh run" About an hour ago Up About an hour 0.0.0.0:8081->8080/tcp tomcat
18930ca6857d mysql:5.6 "docker-entrypoint.s…" 2 hours ago Up 2 hours 0.0.0.0:3306->3306/tcp mysql-5.6
60626de82965 nginx-test:latest "nginx -g 'daemon of…" 5 hours ago Up 5 hours 0.0.0.0:8080->80/tcp dreamy_clarke
- 停止容器
docker stop ID或者名字
- 启动容器
docker start ID或者名字
- 删除容器
docker rm ID或者名字
- 进入容器
docker exec -it 容器名或者容器ID bash # 进入容器的命令行
- 查看所有容器
docker ps -a
- 查看最近一次运行的容器
docker ps -l
- 镜像添加一个新的标签
docker tag 容器ID runoob/centos:dev
- 查看时时日志
docker logs -f 容器名
注意点:
1. 删除前需要保证容器是停止的 stop
2. 需要注意删除镜像和容器的命令不一样。 docker rmi ID ,其中 容器(rm) 和 镜像(rmi)
3. 顺序需要先删除容器