docker学习笔记 Mac安装docker(Version18.09.1)及简单应用

作者: admin 分类: Docker 发布时间: 2019-02-14 22:15  阅读: 493 views

近期做项目,有同事用到了docker,在一脸懵逼的状态下听他讲了一会儿。利用空余时间自己看了下,感觉它就像一个容器。有点像java虚拟机。装好之后可以运行多种不同的java项目。docker装好之后,里面也可以安装不同的应用服务。有效控制了运行环境的版本、安全性等。

 

打开官网
https://hub.docker.com/editions/community/docker-ce-desktop-mac
注册之后,下载最新版本的docker安装文件,安装基本傻瓜式的,不再赘述。以下记录一些常用命令
1. 打开terminal终端后,输入 docker version 会显示以下信息:
chenhailongdeMacBook-Pro:~ chenhailong$ docker version
Client: Docker Engine - Community
 Version:           18.09.1
 API version:       1.39
 Go version:        go1.10.6
 Git commit:        4c52b90
 Built:             Wed Jan  9 19:33:12 2019
 OS/Arch:           darwin/amd64
 Experimental:      false

Server: Docker Engine - Community
 Engine:
  Version:          18.09.1
  API version:      1.39 (minimum version 1.12)
  Go version:       go1.10.6
  Git commit:       4c52b90
  Built:            Wed Jan  9 19:41:49 2019
  OS/Arch:          linux/amd64
  Experimental:     false

2.查找容器信息,例如查找tomcat

chenhailongdeMacBook-Pro:~ chenhailong$ docker search TOMCAT
NAME                                       DESCRIPTION                                     STARS               OFFICIAL            AUTOMATED
tomcat                                     Apache Tomcat is an open source implementati…   2268                [OK]                
tomee                                      Apache TomEE is an all-Apache Java EE certif…   60                  [OK]                
dordoka/tomcat                             Ubuntu 14.04, Oracle JDK 8 and Tomcat 8 base…   52                                      [OK]
davidcaste/alpine-tomcat                   Apache Tomcat 7/8 using Oracle Java 7/8 with…   34                                      [OK]
bitnami/tomcat                             Bitnami Tomcat Docker Image                     27                                      [OK]
cloudesire/tomcat                          Tomcat server, 6/7/8                            14                                      [OK]
meirwa/spring-boot-tomcat-mysql-app        a sample spring-boot app using tomcat and My…   11                                      [OK]
tutum/tomcat                               Base docker image to run a Tomcat applicatio…   11                                      
aallam/tomcat-mysql                        Debian, Oracle JDK, Tomcat & MySQL              10                                      [OK]
jeanblanchard/tomcat                       Minimal Docker image with Apache Tomcat         8                                       
arm32v7/tomcat                             Apache Tomcat is an open source implementati…   6                                       
maluuba/tomcat7-java8                      Tomcat7 with java8.                             3                                       
rightctrl/tomcat                           CentOS , Oracle Java, tomcat application ssl…   3                                       [OK]
amd64/tomcat                               Apache Tomcat is an open source implementati…   2                                       
fabric8/tomcat-8                           Fabric8 Tomcat 8 Image                          2                                       [OK]
arm64v8/tomcat                             Apache Tomcat is an open source implementati…   2                                       
99taxis/tomcat7                            Tomcat7                                         1                                       [OK]
camptocamp/tomcat-logback                  Docker image for tomcat with logback integra…   1                                       [OK]
1and1internet/debian-9-java-8-tomcat-8.5   Our tomcat 8.5 image                            0                                       [OK]
s390x/tomcat                               Apache Tomcat is an open source implementati…   0                                       
picoded/tomcat7                            tomcat7 with jre8 and MANAGER_USER / MANAGER…   0                                       [OK]
oobsri/tomcat8                             Testing CI Jobs with different names.           0                                       
cfje/tomcat-resource                       Tomcat Concourse Resource                       0                                       
jelastic/tomcat                            An image of the Tomcat Java application serv…   0                                       
swisstopo/service-print-tomcat             backend tomcat for service-print "the true, …   0 

3. 拉取tomcat镜像(这里执行时间有点长,跟下载网络环境有关)

chenhailongdeMacBook-Pro:~ chenhailong$ docker pull tomcat
Using default tag: latest
latest: Pulling from library/tomcat
ab1fc7e4bf91: Pull complete 
35fba333ff52: Pull complete 
f0cb1fa13079: Pull complete 
3d79c18d1bc0: Pull complete 
ff1d0ae4641b: Pull complete 
8883e662573f: Pull complete 
adab760d76bd: Pull complete 
86323b680e93: Pull complete 
14a2c1cdce1c: Pull complete 
ee59bf8c5470: Pull complete 
067f988306af: Pull complete 
Digest: sha256:296b26baeee450a9814b2733e9d085f3d26af1c48e5fdc2000496ff7e12bc897
Status: Downloaded newer image for tomcat:latest

4.查看本地镜像(刚才下载的tomcat镜像文件)

chenhailongdeMacBook-Pro:~ chenhailong$ docker images
REPOSITORY          TAG                 IMAGE ID            CREATED             SIZE
tomcat              latest              7ee26c09afb3        5 days ago          462MB

5.启动tomcat, 81是本地端口,8080是容器端口 访问时用81 –name 指定应用的名称(不写的会默认有一个)

chenhailongdeMacBook-Pro:~ chenhailong$ docker run --name teset -p 81:8080 tomcat
29-Jan-2019 06:27:28.018 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Server version:        Apache Tomcat/8.5.37
29-Jan-2019 06:27:28.022 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Server built:          Dec 12 2018 12:07:02 UTC
29-Jan-2019 06:27:28.023 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Server number:         8.5.37.0
29-Jan-2019 06:27:28.023 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log OS Name:               Linux
29-Jan-2019 06:27:28.024 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log OS Version:            4.9.125-linuxkit
29-Jan-2019 06:27:28.024 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Architecture:          amd64
29-Jan-2019 06:27:28.025 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Java Home:             /usr/lib/jvm/java-8-openjdk-amd64/jre
29-Jan-2019 06:27:28.025 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log JVM Version:           1.8.0_181-8u181-b13-2~deb9u1-b13
29-Jan-2019 06:27:28.026 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log JVM Vendor:            Oracle Corporation
29-Jan-2019 06:27:28.027 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log CATALINA_BASE:         /usr/local/tomcat
29-Jan-2019 06:27:28.027 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log CATALINA_HOME:         /usr/local/tomcat
29-Jan-2019 06:27:28.028 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -Djava.util.logging.config.file=/usr/local/tomcat/conf/logging.properties
29-Jan-2019 06:27:28.028 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -Djava.util.logging.manager=org.apache.juli.ClassLoaderLogManager
29-Jan-2019 06:27:28.029 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -Djdk.tls.ephemeralDHKeySize=2048
29-Jan-2019 06:27:28.029 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -Djava.protocol.handler.pkgs=org.apache.catalina.webresources
29-Jan-2019 06:27:28.030 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -Dorg.apache.catalina.security.SecurityListener.UMASK=0027
29-Jan-2019 06:27:28.031 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -Dignore.endorsed.dirs=
29-Jan-2019 06:27:28.031 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -Dcatalina.base=/usr/local/tomcat
29-Jan-2019 06:27:28.032 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -Dcatalina.home=/usr/local/tomcat
29-Jan-2019 06:27:28.033 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -Djava.io.tmpdir=/usr/local/tomcat/temp
29-Jan-2019 06:27:28.033 INFO [main] org.apache.catalina.core.AprLifecycleListener.lifecycleEvent Loaded APR based Apache Tomcat Native library [1.2.19] using APR version [1.5.2].
29-Jan-2019 06:27:28.034 INFO [main] org.apache.catalina.core.AprLifecycleListener.lifecycleEvent APR capabilities: IPv6 [true], sendfile [true], accept filters [false], random [true].
29-Jan-2019 06:27:28.034 INFO [main] org.apache.catalina.core.AprLifecycleListener.lifecycleEvent APR/OpenSSL configuration: useAprConnector [false], useOpenSSL [true]
29-Jan-2019 06:27:28.039 INFO [main] org.apache.catalina.core.AprLifecycleListener.initializeSSL OpenSSL successfully initialized [OpenSSL 1.1.0j  20 Nov 2018]
29-Jan-2019 06:27:28.194 INFO [main] org.apache.coyote.AbstractProtocol.init Initializing ProtocolHandler ["http-nio-8080"]
29-Jan-2019 06:27:28.210 INFO [main] org.apache.tomcat.util.net.NioSelectorPool.getSharedSelector Using a shared selector for servlet write/read
29-Jan-2019 06:27:28.225 INFO [main] org.apache.coyote.AbstractProtocol.init Initializing ProtocolHandler ["ajp-nio-8009"]
29-Jan-2019 06:27:28.226 INFO [main] org.apache.tomcat.util.net.NioSelectorPool.getSharedSelector Using a shared selector for servlet write/read
29-Jan-2019 06:27:28.226 INFO [main] org.apache.catalina.startup.Catalina.load Initialization processed in 703 ms
29-Jan-2019 06:27:28.257 INFO [main] org.apache.catalina.core.StandardService.startInternal Starting service [Catalina]
29-Jan-2019 06:27:28.257 INFO [main] org.apache.catalina.core.StandardEngine.startInternal Starting Servlet Engine: Apache Tomcat/8.5.37
29-Jan-2019 06:27:28.268 INFO [localhost-startStop-1] org.apache.catalina.startup.HostConfig.deployDirectory Deploying web application directory [/usr/local/tomcat/webapps/manager]
29-Jan-2019 06:27:28.688 INFO [localhost-startStop-1] org.apache.catalina.startup.HostConfig.deployDirectory Deployment of web application directory [/usr/local/tomcat/webapps/manager] has finished in [419] ms
29-Jan-2019 06:27:28.689 INFO [localhost-startStop-1] org.apache.catalina.startup.HostConfig.deployDirectory Deploying web application directory [/usr/local/tomcat/webapps/host-manager]
29-Jan-2019 06:27:28.726 INFO [localhost-startStop-1] org.apache.catalina.startup.HostConfig.deployDirectory Deployment of web application directory [/usr/local/tomcat/webapps/host-manager] has finished in [38] ms
29-Jan-2019 06:27:28.733 INFO [localhost-startStop-1] org.apache.catalina.startup.HostConfig.deployDirectory Deploying web application directory [/usr/local/tomcat/webapps/docs]
29-Jan-2019 06:27:28.753 INFO [localhost-startStop-1] org.apache.catalina.startup.HostConfig.deployDirectory Deployment of web application directory [/usr/local/tomcat/webapps/docs] has finished in [27] ms
29-Jan-2019 06:27:28.754 INFO [localhost-startStop-1] org.apache.catalina.startup.HostConfig.deployDirectory Deploying web application directory [/usr/local/tomcat/webapps/ROOT]
29-Jan-2019 06:27:28.774 INFO [localhost-startStop-1] org.apache.catalina.startup.HostConfig.deployDirectory Deployment of web application directory [/usr/local/tomcat/webapps/ROOT] has finished in [20] ms
29-Jan-2019 06:27:28.775 INFO [localhost-startStop-1] org.apache.catalina.startup.HostConfig.deployDirectory Deploying web application directory [/usr/local/tomcat/webapps/examples]
29-Jan-2019 06:27:28.999 INFO [localhost-startStop-1] org.apache.catalina.startup.HostConfig.deployDirectory Deployment of web application directory [/usr/local/tomcat/webapps/examples] has finished in [225] ms
29-Jan-2019 06:27:29.004 INFO [main] org.apache.coyote.AbstractProtocol.start Starting ProtocolHandler ["http-nio-8080"]
29-Jan-2019 06:27:29.017 INFO [main] org.apache.coyote.AbstractProtocol.start Starting ProtocolHandler ["ajp-nio-8009"]
29-Jan-2019 06:27:29.019 INFO [main] org.apache.catalina.startup.Catalina.start Server startup in 792 ms

6.访问地址+端口,正常打开tomcat服务台(可以直接浏览器打开)

chenhailongdeMacBook-Pro:~ chenhailong$ curl "http://127.0.0.1:81"
<!DOCTYPE html>
<html lang="en">
    <head>
        <meta charset="UTF-8" />
        <title>Apache Tomcat/8.5.37</title>
        <link href="favicon.ico" rel="icon" type="image/x-icon" />
        <link href="favicon.ico" rel="shortcut icon" type="image/x-icon" />
        <link href="tomcat.css" rel="stylesheet" type="text/css" />
    </head>

    <body>
        <div id="wrapper">
            <div id="navigation" class="curved container">
                <span id="nav-home"><a href="https://tomcat.apache.org/">Home</a></span>
                <span id="nav-hosts"><a href="/docs/">Documentation</a></span>
                <span id="nav-config"><a href="/docs/config/">Configuration</a></span>
                <span id="nav-examples"><a href="/examples/">Examples</a></span>
                <span id="nav-wiki"><a href="https://wiki.apache.org/tomcat/FrontPage">Wiki</a></span>
                <span id="nav-lists"><a href="https://tomcat.apache.org/lists.html">Mailing Lists</a></span>
                <span id="nav-help"><a href="https://tomcat.apache.org/findhelp.html">Find Help</a></span>
                <br class="separator" />
            </div>
            <div id="asf-box">
                <h1>Apache Tomcat/8.5.37</h1>
            </div>
            <div id="upper" class="curved container">
                <div id="congrats" class="curved container">
                    <h2>If you're seeing this, you've successfully installed Tomcat. Congratulations!</h2>
                </div>
                <div id="notice">
                    <img src="tomcat.png" alt="[tomcat logo]" />
                    <div id="tasks">
                        <h3>Recommended Reading:</h3>
                        <h4><a href="/docs/security-howto.html">Security Considerations HOW-TO</a></h4>
                        <h4><a href="/docs/manager-howto.html">Manager Application HOW-TO</a></h4>
                        <h4><a href="/docs/cluster-howto.html">Clustering/Session Replication HOW-TO</a></h4>
                    </div>
                </div>
                <div id="actions">
                    <div class="button">
                        <a class="container shadow" href="/manager/status"><span>Server Status</span></a>
                    </div>
                    <div class="button">
                        <a class="container shadow" href="/manager/html"><span>Manager App</span></a>
                    </div>
                    <div class="button">
                        <a class="container shadow" href="/host-manager/html"><span>Host Manager</span></a>
                    </div>
                </div>
                <!--
                <br class="separator" />
                -->
                <br class="separator" />
            </div>
            <div id="middle" class="curved container">
                <h3>Developer Quick Start</h3>
                <div class="col25">
                    <div class="container">
                        <p><a href="/docs/setup.html">Tomcat Setup</a></p>
                        <p><a href="/docs/appdev/">First Web Application</a></p>
                    </div>
                </div>
                <div class="col25">
                    <div class="container">
                        <p><a href="/docs/realm-howto.html">Realms &amp; AAA</a></p>
                        <p><a href="/docs/jndi-datasource-examples-howto.html">JDBC DataSources</a></p>
                    </div>
                </div>
                <div class="col25">
                    <div class="container">
                        <p><a href="/examples/">Examples</a></p>
                    </div>
                </div>
                <div class="col25">
                    <div class="container">
                        <p><a href="https://wiki.apache.org/tomcat/Specifications">Servlet Specifications</a></p>
                        <p><a href="https://wiki.apache.org/tomcat/TomcatVersions">Tomcat Versions</a></p>
                    </div>
                </div>
                <br class="separator" />
            </div>
            <div id="lower">
                <div id="low-manage" class="">
                    <div class="curved container">
                        <h3>Managing Tomcat</h3>
                        <p>For security, access to the <a href="/manager/html">manager webapp</a> is restricted.
                        Users are defined in:</p>
                        <pre>$CATALINA_HOME/conf/tomcat-users.xml</pre>
                        <p>In Tomcat 8.5 access to the manager application is split between
                           different users. &nbsp; <a href="/docs/manager-howto.html">Read more...</a></p>
                        <br />
                        <h4><a href="/docs/RELEASE-NOTES.txt">Release Notes</a></h4>
                        <h4><a href="/docs/changelog.html">Changelog</a></h4>
                        <h4><a href="https://tomcat.apache.org/migration.html">Migration Guide</a></h4>
                        <h4><a href="https://tomcat.apache.org/security.html">Security Notices</a></h4>
                    </div>
                </div>
                <div id="low-docs" class="">
                    <div class="curved container">
                        <h3>Documentation</h3>
                        <h4><a href="/docs/">Tomcat 8.5 Documentation</a></h4>
                        <h4><a href="/docs/config/">Tomcat 8.5 Configuration</a></h4>
                        <h4><a href="https://wiki.apache.org/tomcat/FrontPage">Tomcat Wiki</a></h4>
                        <p>Find additional important configuration information in:</p>
                        <pre>$CATALINA_HOME/RUNNING.txt</pre>
                        <p>Developers may be interested in:</p>
                        <ul>
                            <li><a href="https://tomcat.apache.org/bugreport.html">Tomcat 8.5 Bug Database</a></li>
                            <li><a href="/docs/api/index.html">Tomcat 8.5 JavaDocs</a></li>
                            <li><a href="https://svn.apache.org/repos/asf/tomcat/tc8.5.x/">Tomcat 8.5 SVN Repository</a></li>
                        </ul>
                    </div>
                </div>
                <div id="low-help" class="">
                    <div class="curved container">
                        <h3>Getting Help</h3>
                        <h4><a href="https://tomcat.apache.org/faq/">FAQ</a> and <a href="https://tomcat.apache.org/lists.html">Mailing Lists</a></h4>
                        <p>The following mailing lists are available:</p>
                        <ul>
                            <li id="list-announce"><strong><a href="https://tomcat.apache.org/lists.html#tomcat-announce">tomcat-announce</a><br />
                                Important announcements, releases, security vulnerability notifications. (Low volume).</strong>
                            </li>
                            <li><a href="https://tomcat.apache.org/lists.html#tomcat-users">tomcat-users</a><br />
                                User support and discussion
                            </li>
                            <li><a href="https://tomcat.apache.org/lists.html#taglibs-user">taglibs-user</a><br />
                                User support and discussion for <a href="https://tomcat.apache.org/taglibs/">Apache Taglibs</a>
                            </li>
                            <li><a href="https://tomcat.apache.org/lists.html#tomcat-dev">tomcat-dev</a><br />
                                Development mailing list, including commit messages
                            </li>
                        </ul>
                    </div>
                </div>
                <br class="separator" />
            </div>
            <div id="footer" class="curved container">
                <div class="col20">
                    <div class="container">
                        <h4>Other Downloads</h4>
                        <ul>
                            <li><a href="https://tomcat.apache.org/download-connectors.cgi">Tomcat Connectors</a></li>
                            <li><a href="https://tomcat.apache.org/download-native.cgi">Tomcat Native</a></li>
                            <li><a href="https://tomcat.apache.org/taglibs/">Taglibs</a></li>
                            <li><a href="/docs/deployer-howto.html">Deployer</a></li>
                        </ul>
                    </div>
                </div>
                <div class="col20">
                    <div class="container">
                        <h4>Other Documentation</h4>
                        <ul>
                            <li><a href="https://tomcat.apache.org/connectors-doc/">Tomcat Connectors</a></li>
                            <li><a href="https://tomcat.apache.org/connectors-doc/">mod_jk Documentation</a></li>
                            <li><a href="https://tomcat.apache.org/native-doc/">Tomcat Native</a></li>
                            <li><a href="/docs/deployer-howto.html">Deployer</a></li>
                        </ul>
                    </div>
                </div>
                <div class="col20">
                    <div class="container">
                        <h4>Get Involved</h4>
                        <ul>
                            <li><a href="https://tomcat.apache.org/getinvolved.html">Overview</a></li>
                            <li><a href="https://tomcat.apache.org/svn.html">SVN Repositories</a></li>
                            <li><a href="https://tomcat.apache.org/lists.html">Mailing Lists</a></li>
                            <li><a href="https://wiki.apache.org/tomcat/FrontPage">Wiki</a></li>
                        </ul>
                    </div>
                </div>
                <div class="col20">
                    <div class="container">
                        <h4>Miscellaneous</h4>
                        <ul>
                            <li><a href="https://tomcat.apache.org/contact.html">Contact</a></li>
                            <li><a href="https://tomcat.apache.org/legal.html">Legal</a></li>
                            <li><a href="https://www.apache.org/foundation/sponsorship.html">Sponsorship</a></li>
                            <li><a href="https://www.apache.org/foundation/thanks.html">Thanks</a></li>
                        </ul>
                    </div>
                </div>
                <div class="col20">
                    <div class="container">
                        <h4>Apache Software Foundation</h4>
                        <ul>
                            <li><a href="https://tomcat.apache.org/whoweare.html">Who We Are</a></li>
                            <li><a href="https://tomcat.apache.org/heritage.html">Heritage</a></li>
                            <li><a href="https://www.apache.org">Apache Home</a></li>
                            <li><a href="https://tomcat.apache.org/resources.html">Resources</a></li>
                        </ul>
                    </div>
                </div>
                <br class="separator" />
            </div>
            <p class="copyright">Copyright &copy;1999-2019 Apache Software Foundation.  All Rights Reserved</p>
        </div>
    </body>
</html>

7.查看运行中的镜像

chenhailongdeMacBook-Pro:~ chenhailong$ docker ps 
CONTAINER ID        IMAGE               COMMAND             CREATED             STATUS              PORTS                  NAMES
5f81278c489c        tomcat              "catalina.sh run"   3 minutes ago       Up 3 minutes        0.0.0.0:81->8080/tcp   loving_hellman

8.开启应用

chenhailongdeMacBook-Pro:~ chenhailong$ docker start gateway
gateway

 

9.进入虚拟终端(就像进入了远程linux系统)

chenhailongdeMacBook-Pro:~ chenhailong$ docker exec -it 6da0e92a0d53 /bin/bash 
root@6da0e92a0d53:/usr/local/tomcat# ls
BUILDING.txt  CONTRIBUTING.md  LICENSE	NOTICE	README.md  RELEASE-NOTES  RUNNING.txt  bin  conf  include  lib	logs  native-jni-lib  temp  webapps  work
root@6da0e92a0d53:/usr/local/tomcat# 

一般的容器都可以进入 bin/bash目录,个别不行的话,试试 sh
chenhailongdeMacBook-Pro:~ chenhailong$ docker exec -it 8698d10c9a3c sh
/api/vendors # ls

10.如果没有目标,会自动下载安装(这里是没有安装mongodb但是直接运行执行命令,它会自动安装mongodb)

chenhailongdeMacBook-Pro:~ chenhailong$ docker run -d --name mongo-yapi -v mongo_data_yapi:/data/db mongo
Unable to find image 'mongo:latest' locally
latest: Pulling from library/mongo
7b722c1070cd: Downloading [==============>                                    ]  12.82MB/43.52MB
5fbf74db61f1: Download complete 
ed41cb72e5c9: Download complete 
7ea47a67709e: Download complete 
778aebe6fb26: Download complete 
3b4b1e0b80ed: Download complete 
844ccc42fe76: Download complete 
eab01fe8ebf8: Download complete 
e5758d5381b1: Download complete 
a795f1f35522: Download complete 
67bc6388d1cd: Downloading [=====>                                             ]  9.047MB/89.82MB
89b55f4f3473: Download complete 
10886b20b4fc: Download complete 

11. 获取镜像文件/ 项目文件(找网上开源的docker项目进行下载)

chenhailongdeMacBook-Pro:~ chenhailong$ docker pull registry.cn-hangzhou.aliyuncs.com/anoy/yapi
Using default tag: latest
latest: Pulling from anoy/yapi
1160f4abea84: Pull complete 
468a69587a1f: Pull complete 
1adfb2d15fdc: Pull complete 
5dc7ffbf2127: Pull complete 
845514a9ce73: Pull complete 
Digest: sha256:c697e071146d88ad83cc07eafda49cfb203c470d378e50e0302c9ae603bc8919
Status: Downloaded newer image for registry.cn-hangzhou.aliyuncs.com/anoy/yapi:latest

12.docker空间的维护利用

#列出docker储存卷
chenhailongdeMacBook-Pro:~ chenhailong$ docker volume ls
DRIVER              VOLUME NAME
local               yapi-mongo
#创建一个储存卷
chenhailongdeMacBook-Pro:~ chenhailong$ docker volume create yapi-mongo
yapi-mongo
#删除一个储存卷
chenhailongdeMacBook-Pro:~ chenhailong$ docker volume rm yapi-mongo
yapi-mongo

暂时先更新到这里.   不同类型的项目启动需要指定参数。

以后有用到在更新


   原创文章,转载请标明本文链接: docker学习笔记 Mac安装docker(Version18.09.1)及简单应用

如果觉得我的文章对您有用,请随意打赏。您的支持将鼓励我继续创作!

发表评论

电子邮件地址不会被公开。 必填项已用*标注

更多阅读