エセイー(エセSE)が挑戦する、初めてのDocker假冒(假冒者)挑战的,首次尝试的Docker

在下面的网站中,写有关于基本使用方法的内容。
https://qiita.com/kariyaitaru/items/83fe1c8c9ed4f8732a63

参考此网站,从Docker Hub上获取数据。
https://kitsune.blog/docker-install

docker run -d -p 8080:80 --name nginx nginx

访问Nginx服务器。

http://localhost:8080

停止或启动上述容器。

# コンテナを停止
$ docker stop nginx
nginx

# コンテナを起動
$ docker start nginx
nginx

随后,尝试从容器中创建镜像。以下内容参考自「https://kitsune.blog/docker-comman」。

    1. 获取Docker基础镜像

 

    1. 启动Docker容器

 

    1. 修改Docker容器

 

    创建Docker镜像

检查Docker镜像

C:\Users\XXXXX>docker images
REPOSITORY          TAG                 IMAGE ID            CREATED             SIZE
nginx               latest              6678c7c2e56c        11 days ago         127MB

要在Docker Hub上搜索基础镜像,可以运行”docker search”命令。

C:\Users\XXXXX>docker search centos
NAME                               DESCRIPTION                                     STARS               OFFICIAL            AUTOMATED
centos                             The official build of CentOS.                   5884                [OK]             
ansible/centos7-ansible            Ansible on Centos7                              128                                     [OK]
jdeathe/centos-ssh                 OpenSSH / Supervisor / EPEL/IUS/SCL Repos - …   114                                     [OK]
consol/centos-xfce-vnc             Centos container with "headless" VNC session…   111                                     [OK]
centos/mysql-57-centos7            MySQL 5.7 SQL database server                   71                                   
imagine10255/centos6-lnmp-php56    centos6-lnmp-php56                              58                                      [OK]
tutum/centos                       Simple CentOS docker image with SSH access      45                                   
centos/postgresql-96-centos7       PostgreSQL is an advanced Object-Relational …   43                                  
kinogmt/centos-ssh                 CentOS with SSH                                 29                                      [OK]
pivotaldata/centos-gpdb-dev        CentOS image for GPDB development. Tag names…   11                                  
guyton/centos6                     From official centos6 container with full up…   10                                      [OK]
nathonfowlie/centos-jre            Latest CentOS image with the JRE pre-install…   8                                       [OK]
drecom/centos-ruby                 centos ruby                                     6                                       [OK]
centos/tools                       Docker image that has systems administration…   6                                       [OK]
pivotaldata/centos                 Base centos, freshened up a little with a Do…   4                                   
darksheer/centos                   Base Centos Image -- Updated hourly             3                                       [OK]
mamohr/centos-java                 Oracle Java 8 Docker image based on Centos 7    3                                       [OK]
pivotaldata/centos-mingw           Using the mingw toolchain to cross-compile t…   3                                   
pivotaldata/centos-gcc-toolchain   CentOS with a toolchain, but unaffiliated wi…   3                                   
miko2u/centos6                     CentOS6 日本語環境                                   2                                       [OK]
indigo/centos-maven                Vanilla CentOS 7 with Oracle Java Developmen…   1                                       [OK]
blacklabelops/centos               CentOS Base Image! Built and Updates Daily!     1                                       [OK]
pivotaldata/centos6.8-dev          CentosOS 6.8 image for GPDB development         0                                    
pivotaldata/centos7-dev            CentosOS 7 image for GPDB development           0                                    
smartentry/centos                  centos with smartentry                          0                                       [OK]

要下载容器,可以使用命令”docker pull OS名:版本”(版本可省略)。本次执行的命令是”docker pull centos:7″。

C:\Users\XXXXX>docker pull centos:7
7: Pulling from library/centos
ab5ef0e58194: Pull complete
Digest: sha256:4a701376d03f6b39b8c2a8f4a8e499441b0d567f9ab9d58e4991de4472fb813c
Status: Downloaded newer image for centos:7
docker.io/library/centos:7

使用「docker images」命令来查看镜像。

C:\Users\XXXXX >docker images
REPOSITORY          TAG                 IMAGE ID            CREATED             SIZE
nginx               latest              6678c7c2e56c        11 days ago         127MB
centos              7                   5e35e350aded        4 months ago        203MB

查看Docker容器清单

查看Docker容器列表的命令如下。

    • 起動中のコンテナのみを表示する:docker ps

停止中のコンテナも表示する:docker ps -a

创建一个 Dockerfile。
https://kitsune.blog/dockerfile-summary

广告
将在 10 秒后关闭
bannerAds