Docker安装禅道

1.使用docker images检查本地是否有该镜像(是否有安装包?)

docker images

执行结果

REPOSITORY                    TAG                 IMAGE ID            CREATED             SIZE
redis                         latest              4cdbec704e47        2 weeks ago         98.2MB
rabbitmq                      3.7-management      c2ba489d55cc        4 weeks ago         179MB
idoop/zentao                  latest              300a78cfdd96        6 weeks ago         145MB
jayfong/yapi                  latest              03adced75d35        8 weeks ago         437MB
mongo-express                 latest              fd78ac5dfca8        8 weeks ago         129MB
sonatype/nexus3               latest              7e6931b4cdf2        2 months ago        640MB
redis                                       44d36d2c2374        2 months ago        98.2MB
vien/elasticsearch-with-ik    7.3.0               b200381c8473        3 months ago        1.02GB
cassandra                     latest              68144c842c79        3 months ago        324MB
wurstmeister/kafka            latest              60e65edd85cc        4 months ago        432MB
wurstmeister/kafka            2.11-0.11.0.3       f25efdd85431        4 months ago        413MB
flink                         latest              90fcc5a3f41b        4 months ago        532MB
zookeeper                     latest              611ffeaf5959        4 months ago        224MB
openjdk                       11                  243e95d792e3        4 months ago        605MB
nginx                         latest              231d40e811cd        4 months ago        126MB
mongo                         latest              965553e202a4        5 months ago        363MB
elasticsearch                 7.3.0               bdaab402b220        8 months ago        806MB
wurstmeister/zookeeper        latest              3f43f72cb283        15 months ago       510MB
mysql                         5.7.22              6bb891430fb6        21 months ago       372MB
tobias74/elasticsearch-head   6                   301c944ca40a        21 months ago       812MB
hwestphal/kafka-web-console   latest              fd43d53dd9b2        5 years ago         1.16GB

通过REPOSITORY这一列可以看到我本地有idoop/zentao该镜像了。

2.如果没有就通过docker search查找远程仓库是否有该镜像。

docker search zentao

执行结果

NAME                          DESCRIPTION                                     STARS               OFFICIAL            AUTOMATED
idoop/zentao                  For zentao(禅道).                                 68                                      [OK]
haha123/zentao                ubuntu14,zentao8.3.1                            16                                      [OK]
hofmann/zentao                zentao                                          3                                       [OK]
dazyun/zentao                                                                 2                                       
beerbubble/zentao             禅道docker镜像                                      1                                       
oceanwu/zentao                禅道项目管理软件8.2.beta                                1                                       [OK]
sandersliu/zentao             zentao 9.2.1                                    1                                       [OK]
yinguowei/zentao              'Zentao'(禅道 http://www.zentao.net) docke…       1                                       
yitengshidai/zentao_8.2.4     禅道项目管理系统                                        1                                       
singula/zentao                zentao 9.8.3                                    0                                       [OK]
latelee/zentao                zentao 9.8.3                                    0                                       [OK]
goodrainapps/zentaopms        The zentaopms v10.2.2 has update.               0                                       [OK]
yehai/zentao-pro              For zentao(禅道).                                 0                                       [OK]
zyf123/zentao                                                                 0                                       
roamlog/zentao                zentao(禅道).                                     0                                       
xzchen/zentaopms              zentao & git & ...                              0                                       
bestwu/zentao                 zentao                                          0                                       [OK]
cuckoohello/zentao            zentao based on alpine                          0                                       [OK]
chaiyd/zentao                 https://github.com/chaiyd/zentao.git            0                                       
zhangsean/zentao              Auto build docker image for Zentao PMS with …   0                                       
curiouser/zentao              容器化的禅道                                          0                                       
wener/zentao                                                                  0                                       
hb0730/zentao                 禅道 https://www.zentao.net                       0                                       
sunshine6688/zentao-project                                                   0                                       
a273218159/zentao             zentao 10.3.1                                   0                                  

一般我是根据 STARS星数去选择拉去哪个镜像。

3.执行docker pull命令拉取(下载镜像)

docker pull idoop/zentao 

pull 后面的参数为NAME那一列的值。

4.执行步骤1查看是否拉取成功。

5.执行docker run命令运行容器。

docker run --name zentao -p 80:80 -d 300a78cfdd96

参数解释

  • --name 指定容器名字(注意不可重复)。
  • -p 将本机的指定端口映射到容器的指定端口 本机端口:容器端口
  • -d 容器开启后台运行。
  • 300a78cfdd96 这串乱码其实是镜像ID,根据docker images后的IMAGES ID获取。

注意

在执行docker run的时候可能会出现以下问题。

1.容器名冲突。

docker: Error response from daemon: Conflict. The container name "/zentao" is already in use by container "200ac9064bc84f0455d85f95ae1f791da87bf1fe43a99df20bc9c59096db7f9b". You have to remove (or rename) that container to be able to reuse that name.
See 'docker run --help'.

在docker中容器的名称是具有唯一性的,如果运行的新容器名称已经存在则会报以上的错误。

解决方案

要么给新容器重新想个名字,或者执行docker ps -a 命令查看所有docker容器。

docker ps -a

参数解释

  • -a 列出docker所有容器

执行结果

CONTAINER ID        IMAGE                              COMMAND                  CREATED             STATUS                           PORTS                              NAMES
93fe28a85b0b        300a78cfdd96                       "docker-entrypoint"      38 minutes ago      Up 38 minutes (healthy)          3306/tcp, 0.0.0.0:8978->80/tcp     zzst
834de7fcdf34        300a78cfdd96                       "docker-entrypoint"      39 minutes ago      Created                                                             izst
bfb00c2cd064        300a78cfdd96                       "docker-entrypoint"      41 minutes ago      Created                                                             edc
ac396bb60c73        300a78cfdd96                       "docker-entrypoint"      41 minutes ago      Created                                                             zst
200ac9064bc8        300a78cfdd96                       "docker-entrypoint"      42 minutes ago      Created                                                             zentao
01d8f83f246b        300a78cfdd96                       "docker-entrypoint"      57 minutes ago      Exited (137) 38 minutes ago                                         festive_mcnulty
7fab94b49be2        300a78cfdd96                       "docker-entrypoint"      About an hour ago   Exited (137) 38 minutes ago                                         frosty_varahamihira
29d38474ebd4        4cdbec704e47                       "docker-entrypoint.s…"   About an hour ago   Exited (0) About an hour ago                                        stupefied_perlman
dbc2ea31010c        4cdbec704e47                       "docker-entrypoint.s…"   About an hour ago   Exited (0) About an hour ago                                        sweet_darwin
10b4270b9351        300a78cfdd96                       "docker-entrypoint"      About an hour ago   Exited (137) 38 minutes ago                                         laughing_hugle
dfdaa159e8a6        300a78cfdd96                       "docker-entrypoint"      About an hour ago   Exited (137) 38 minutes ago                                         nostalgic_sammet
f6d10751f11e        300a78cfdd96                       "docker-entrypoint"      About an hour ago   Exited (137) 38 minutes ago                                         sweet_bhabha
32bf6f991565        300a78cfdd96                       "docker-entrypoint"      2 hours ago         Exited (137) 38 minutes ago                                         lucid_taussig
08a88bd98b1c        300a78cfdd96                       "docker-entrypoint"      2 hours ago         Exited (137) 38 minutes ago                                         loving_davinci
9b80480fa64e        300a78cfdd96                       "docker-entrypoint"      2 hours ago         Exited (137) 38 minutes ago                                         trusting_davinci
3fae9b4e0667        300a78cfdd96                       "docker-entrypoint"      2 hours ago         Exited (137) 38 minutes ago                                         brave_snyder
eecd23efbca0        300a78cfdd96                       "docker-entrypoint"      2 hours ago         Exited (137) 38 minutes ago                                         admiring_lovelace
c92566e2e480        300a78cfdd96                       "docker-entrypoint"      2 hours ago         Exited (137) 38 minutes ago                                         romantic_burnell
d70a6cd6f44b        idoop/zentao:latest                "docker-entrypoint"      2 hours ago         Created                                                             zentao-server
3dbb12f23638        4cdbec704e47                       "docker-entrypoint.s…"   7 days ago          Exited (0) 2 days ago                                               strange_heyrovsky
034808ad2afe        4cdbec704e47                       "docker-entrypoint.s…"   7 days ago          Exited (0) 7 days ago                                               optimistic_mcclintock
64079d70c4c2        4cdbec704e47                       "docker-entrypoint.s…"   7 days ago          Exited (0) 39 minutes ago                                           redis
a84d7ec6328c        4cdbec704e47                       "docker-entrypoint.s…"   7 days ago          Exited (1) 7 days ago                                               fervent_maxwell
4f00448546f9        4cdbec704e47                       "docker-entrypoint.s…"   7 days ago          Exited (0) 7 days ago                                               frosty_ardinghelli
d3e3fcd82344        nginx                              "nginx -g 'daemon of…"   12 days ago         Exited (1) 12 days ago                                              nginx_nginx_1
0068a643a1aa        rabbitmq:3.7-management            "docker-entrypoint.s…"   2 weeks ago         Exited (137) 33 minutes ago                                         rabbitmq-dev
0f19ee6c6b3c        jayfong/yapi:latest                "docker-entrypoint.s…"   4 weeks ago         Exited (137) About an hour ago                                      yapi-web
29dcc61d5b9f        mongo                              "docker-entrypoint.s…"   6 weeks ago         Up 38 minutes                    0.0.0.0:27017->27017/tcp           mongo_mongo_1
8710e07279d5        mongo-express                      "tini -- /docker-ent…"   6 weeks ago         Up 38 minutes                    8081/tcp, 0.0.0.0:8099->8099/tcp   mongo_mongo-express_1
ca6fa72d4a2b        mongo:latest                       "docker-entrypoint.s…"   7 weeks ago         Exited (0) 2 hours ago                                              yapi-mongo
d34a22683bc8        mysql:5.7.22                       "docker-entrypoint.s…"   7 weeks ago         Up 38 minutes                    0.0.0.0:3306->3306/tcp             mysql
9381e3b60212        sonatype/nexus3                    "sh -c ${SONATYPE_DI…"   7 weeks ago         Up 9 seconds                     0.0.0.0:8081->8081/tcp             nexus
a0266fd9a4bc        wurstmeister/kafka:2.11-0.11.0.3   "start-kafka.sh"         3 months ago        Exited (137) 7 weeks ago                                            kafka_kafka_1
c943357189e5        wurstmeister/zookeeper             "/bin/sh -c '/usr/sb…"   3 months ago        Exited (137) 2 weeks ago                                            kafka_zookeeper_1
fa63db50fd88        cassandra                          "docker-entrypoint.s…"   3 months ago        Exited (143) 3 months ago                                           cassandra_web_1
847787bac55b        vien/elasticsearch-with-ik:7.3.0   "/usr/local/bin/dock…"   3 months ago        Exited (78) 3 months ago                                            interesting_black
aa4c6c360aae        hwestphal/kafka-web-console        "/bin/sh -c 'exec /k…"   3 months ago        Exited (143) 3 months ago                                           kafka-web-console_kafka-web-console_1
501440d21a7f        mongo                              "docker-entrypoint.s…"   4 months ago        Exited (0) 3 months ago                                             competent_sammet

根据NAME那一列找到冲突的名字并删除该容器,执行docker rm -f CONTAINER ID然后再重新运行容器即可。

docker rm -f  CONTAINER ID

你可能感兴趣的:(Docker)