Linux docker常用命令

文章目录

    • 安装doeker
    • docker加速
    • docker常用操作
      • docker search
      • docker pull
      • docker images
      • docker create

安装doeker

cd /etc/yum.repos.d/
curl -o docker-ce.repo https://mirrors.tuna.tsinghua.edu.cn/docker-ce/linux/centos/docker-ce.repo
sed -i 's@https://download.docker.com@https://mirrors.tuna.tsinghua.edu.cn/docker-ce@g' docker-ce.repo

yum -y install docker-ce

阿里云镜像网站https://developer.aliyun.com/packageSearch?word=docker

docker加速

docker-ce的配置文件是/etc/docker/daemon.json,此文件默认不存在,需要我们手动创建并进行配置,而docker的加速就是通过配置此文件来实现的。

systemctl start docker

cat > /etc/docker/daemon.json <

docker常用操作

命令 功能
docker search 查找镜像
docker pull 拉取镜像
docker images 列出镜像
docker create 创建一个容器
docker start 开启一个或多个容器
docker run 在新容器里运行
docker attach 进入一个正在运行的容器
docker ps 列出正在运行的容器
docker logs 查看容器的日志
docker restart 重启docker
docker stop 停止一个或多个容器
docker kill 杀死一个或多个容器
docker rm 删除一个或多个容器
docker exec 在正在运行的容器中运行
docker info 列出docker的信息
docker inspect 列出一个容器的信息

docker search

[root@localhost yum.repos.d]# docker search nginx
NAME                               DESCRIPTION                                     STARS               OFFICIAL            AUTOMATED
nginx                              Official build of Nginx.                        12902               [OK]                
jwilder/nginx-proxy                Automated Nginx reverse proxy for docker con…   1760                                    [OK]
richarvey/nginx-php-fpm            Container running Nginx + PHP-FPM capable of…   760                                     [OK]
linuxserver/nginx                  An Nginx container, brought to you by LinuxS…   102                                     
bitnami/nginx                      Bitnami nginx Docker Image                      81                                      [OK]
tiangolo/nginx-rtmp                Docker image with Nginx using the nginx-rtmp…   66                                      [OK]
jc21/nginx-proxy-manager           Docker container for managing Nginx proxy ho…   46                                      
nginxdemos/hello                   NGINX webserver that serves a simple page co…   45                                      [OK]
nginx/unit                         NGINX Unit is a dynamic web and application …   36                                      
jlesage/nginx-proxy-manager        Docker container for Nginx Proxy Manager        36                                      [OK]
nginx/nginx-ingress                NGINX Ingress Controller for Kubernetes         28                                      
privatebin/nginx-fpm-alpine        PrivateBin running on an Nginx, php-fpm & Al…   23                                      [OK]
schmunk42/nginx-redirect           A very simple container to redirect HTTP tra…   18                                      [OK]
nginxinc/nginx-unprivileged        Unprivileged NGINX Dockerfiles                  13                                      
centos/nginx-18-centos7            Platform for running nginx 1.8 or building n…   13                                      
blacklabelops/nginx                Dockerized Nginx Reverse Proxy Server.          13                                      [OK]
raulr/nginx-wordpress              Nginx front-end for the official wordpress:f…   12                                      [OK]
centos/nginx-112-centos7           Platform for running nginx 1.12 or building …   12                                      
nginx/nginx-prometheus-exporter    NGINX Prometheus Exporter                       10                                      
sophos/nginx-vts-exporter          Simple server that scrapes Nginx vts stats a…   7                                       [OK]
mailu/nginx                        Mailu nginx frontend                            6                                       [OK]
bitnami/nginx-ingress-controller   Bitnami Docker Image for NGINX Ingress Contr…   4                                       [OK]
ansibleplaybookbundle/nginx-apb    An APB to deploy NGINX                          1                                       [OK]
wodby/nginx                        Generic nginx                                   0                                       [OK]
centos/nginx-110-centos7           Platform for running nginx 1.10 or building …   0                                       

docker pull

//拉取nginx
[root@localhost yum.repos.d]# docker pull nginx
Using default tag: latest
latest: Pulling from library/nginx
c499e6d256d6: Retrying in 1 second 
74cda408e262: Downloading 
ffadbd415ab7: Download complete 
latest: Pulling from library/nginx
c499e6d256d6: Pull complete 
74cda408e262: Downloading  3.455MB/23.92MB
ffadbd415ab7: Download complete 

docker images

[root@localhost yum.repos.d]# docker images
REPOSITORY          TAG                 IMAGE ID            CREATED             SIZE

docker create




你可能感兴趣的:(Linux docker常用命令)