Docker安装和使用
Posted warren
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了Docker安装和使用相关的知识,希望对你有一定的参考价值。
一,安装Docker
1.1 安装之前保持一个干净的Docker环境
sudo yum remove docker docker-common docker-selinux docker-engine
1.2 安装一些依赖
sudo yum install -y yum-utils device-mapper-persistent-data lvm2
1.3 下载repo文件
wget -O /etc/yum.repos.d/docker-ce.repo https://download.docker.com/linux/centos/docker-ce.repo
1.4 把软件仓管地址替换为 TUNA
sudo sed -i \'s+download.docker.com+mirrors.tuna.tsinghua.edu.cn/docker-ce+\' /etc/yum.repos.d/docker-ce.repo
1.5 安装
sudo yum makecache fast sudo yum install docker-ce
参考文档:https://mirrors.tuna.tsinghua.edu.cn/help/docker-ce/
1.6 安装完成后可以使用:dock version 命令查看docker信息
[root@linux-node1 ~]# Client: Version: 17.09.0-ce API version: 1.32 Go version: go1.8.3 Git commit: afdb6d4 Built: Tue Sep 26 22:41:23 2017 OS/Arch: linux/amd64 Server: Version: 17.09.0-ce API version: 1.32 (minimum version 1.12) Go version: go1.8.3 Git commit: afdb6d4 Built: Tue Sep 26 22:42:49 2017 OS/Arch: linux/amd64 Experimental: false
二,安装docker-compose
2.1 先确认完成docker环境安装,再执行此步骤
2.2 参考文档:
https://docs.docker.com/compose/install/
2.3 以CentOS为例:
2.3.1下载docker compose执行文件
sudo curl -L https://github.com/docker/compose/releases/download/1.17.0/docker-compose-`uname -s`-`uname -m` -o /usr/local/bin/docker-compose
2.3.2 添加执行权限
sudo chmod +x /usr/local/bin/docker-compose
2.3.3 验证结果
docker-compose --version docker-compose version 1.17.0, build 1719ceb
三,下载镜像文件
3.1 配置国内Docker镜像加速,国内拉取官方docker镜像速度较慢
[root@linux-node1 data]# more /etc/docker/daemon.json
{"registry-mirrors": ["http://4c7d9402.m.daocloud.io"]}
3.2 下载Docker的Cent0S镜像
[root@linux-node1 ~]# docker pull centos Using default tag: latest latest: Pulling from library/centos d9aaf4d82f24: Pull complete Digest: sha256:4565fe2dd7f4770e825d4bd9c761a81b26e49cc9e3c9631c58cfc3188be9505a Status: Downloaded newer image for centos:latest
3.3 查看镜像
[root@linux-node1 ~]# docker images REPOSITORY TAG IMAGE ID CREATED SIZE centos latest d123f4e55e12 3 weeks ago 197MB
3.4 根据一个镜像可以启动多个容器,启动容器的命令是docker run
[root@linux-node1 ~]# docker run -i -t centos /bin/bash [root@0ac90dce2eee /]#
-t 表示让Docker分配一个伪终端并绑定到容器的标准输入上
-i 表示让容器的标准输入保持打开
-d 表示以守护方式打开(即非交互模式,后台运行)
还有一个比较常用的,做网络配置时端口映射的参数-p,例如下面的命令将宿主机的3222端口映射到容器的22端口、将宿主机的3280端口映射到容器的80端口,用法如下:
#-p 设置端口映射 -p 宿主机端口:容器端口 docker run -t -i -p 3222:22 -p 3280:80 87e5b6b3ccc1 /bin/bash
3.5 搜索镜像,比如搜索一个redis的镜像,STARS 越多说明越好
[root@linux-node1 ~]# docker search redis NAME DESCRIPTION STARS OFFICIAL AUTOMATED redis Redis is an open source key-value store th... 4483 [OK] bitnami/redis Bitnami Redis Docker Image 61 [OK] sameersbn/redis 59 [OK] tenstartups/redis-commander 31 [OK] joshula/redis-sentinel A container for Redis Sentinel 19 kubeguide/redis-master redis-master with "Hello World!" 19 kubeguide/guestbook-redis-slave Guestbook redis slave 15 tutum/redis Base docker image to run a Redis server 10 webhippie/redis Docker images for redis 7 [OK] rtoma/logspout-redis-logstash Logspout including Redis adapter for sendi... 5 gurpartap/redis Smallest redis image at 18.56MB, 5.6MB of ... 3 arm32v7/redis Redis is an open source key-value store th... 3 centos/redis-32-centos7 Redis in-memory data structure store, used... 2 tomesar/redis-arm Redis for ARM! 2 [OK] google/guestbook-python-redis A simple guestbook example written in Pyth... 1 frodenas/redis A Docker Image for Redis 1 [OK] dynomitedb/redis Redis backend for DynomiteDB. 1 [OK] vidazoohub/marathon-redis-autoscale autoscale worker tasks based on redis size 1 [OK] sstarcher/fluent-redis-aws https://github.com/sstarcher/docker-fluent... 0 [OK] brendangibat/docker-logspout-redis Docker Logspout container with Logspout-Re... 0 [OK] anchorfree/redis redis cache server for logging 0 kilsoo75/redis-master This image is for the redis master of SK C... 0 iadvize/redis 0 rediscommander/redis-commander Alpine image for redis-commander - Redis m... 0 [OK] ajmath/fluentd-redis Use fluentd logs to send docker logs to re... 0 [OK]
3.5 查看及删除镜像
docker images: # 列出images docker images -a # 列出所有的images(包含历史) docker rmi <image ID>: # 删除一个或多个image
3.6 查看容器
docker ps :列出当前所有正在运行的container docker ps -l :列出最近一次启动的container docker ps -a :列出所有的container(包含历史,即运行过的container) docker ps -q :列出最近一次运行的container ID
3.7 重启容器等操作
docker start/stop/restart <container> #:开启/停止/重启container docker start [container_id] #:再次运行某个container (包括历史container) docker attach [container_id] #:连接一个正在运行的container实例(即实例须为start状态,可以多个窗口同时attach 一个container实例) docker start -i <container> #:启动一个container并进入交互模式(相当于先start,在attach) docker run -i -t <image> /bin/bash #:使用image创建container并进入交互模式, login shell是/bin/bash docker run -i -t -p <host_port:contain_port> #:映射 HOST 端口到容器,方便外部访问容器内服务,host_port 可以省略,省略表示把 container_port 映射到一个动态端口。 #注:使用start是启动已经创建过得container,使用run则通过image开启一个新的 container。
3.8 删除容器
docker rm <container...> #:删除一个或多个container docker rm `docker ps -a -q` #:删除所有的container docker ps -a -q | xargs docker rm #:同上, 删除所有的container
四,Docker镜像文件导入导出
4.1 查看镜像id
[root@linux-node1 ~]# docker images REPOSITORY TAG IMAGE ID CREATED SIZE sonarqube latest c1637bd4502f 12 days ago 934MB jenkins latest 3f08dc4f3f5d 3 weeks ago 809MB centos latest d123f4e55e12 3 weeks ago 197MB
4.2 选择要打包的镜像,执行打包命令
#方法一 [root@linux-node1 ~]# docker save -o centos.tar centos #镜像名称 [root@linux-node1 ~]# ls anaconda-ks.cfg centos.tar #方法二 确切的说,export其实是容器的保存,只把镜像当前的状态保存下来 [root@linux-node1 ~]# docker export -o centos-1.tar b2be6c76c9e2 #容器id
会在当前目录下生成导出文件xxx.tar,然后将此文件下载到本地
4.3 导入上述打包的镜像
五,使用Docker Compose管理多个容器
Docker Compose是一个用来定义和运行复杂应用的Docker工具。使用Compose,你可以在一个文件中定义一个多容器应用,然后使用一条命令来启动你的应用,完成一切准备工作。
- github.com/docker/compose
5.1 一个使用Docker容器的应用,通常由多个容器组成。使用Docker Compose,不再需要使用shell脚本来启动容器。在配置文件中,所有的容器通过services
来定义,然后使用docker-compose
脚本来启动,停止和重启应用,和应用中的服务以及所有依赖服务的容器。完整的命令列表如下:
build 构建或重建服务 help 命令帮助 kill 杀掉容器 logs 显示容器的输出内容 port 打印绑定的开放端口 ps 显示容器 pull 拉取服务镜像 restart 重启服务 rm 删除停止的容器 run 运行一个一次性命令 scale 设置服务的容器数目 start 开启服务 stop 停止服务 up 创建并启动容器
参考 https://docs.docker.com/compose/install/ 。你能运行Compose在OSX和64位Linux
5.2 在上面2.1步骤中我们已经安装了 Doceker Compose
curl -L https://github.com/docker/compose/releases/download/1.4.2/docker-compose-`uname -s`-`uname -m` > /usr/local/bin/docker-compose chmod x /usr/local/bin/docker-compose
5.3 Compose的配置文件是docker-compose.yml
。让我们看看下面这个文件:
[root@linux-node1 devops]# cat docker-compose.yml version: \'2\' services: gitlab: image: gitlab/gitlab-ce:latest ports: - "443:443" - "80:80" - "22:22" networks: - devops volumes: - /root/data/gitlab/config:/etc/gitlab - /root/data/gitlab/logs:/var/log/gitlab - /root/data/gitlab/data:/var/opt/gitlab jenkins: image: jenkins:latest ports: - "8080:8080" - "50000:50000" networks: - devops volumes: - /root/data/jenkins:/var/jenkins_home - /var/run/docker.sock:/var/run/docker.sock sonarqube: image: sonarqube:latest ports: - "9000:9000" - "9092:9092" networks: - devops networks: devops: driver: bridge
a. 定义了两个服务分别叫做gitlab,jenkins和sonarqube
b. 使用image
定义每个服务的镜像名
c. networks:定义网络类型
d. volumes:定义卷与本地磁盘的映射关系
e. 使用ports
实现端口转发
5.4 启动服务
docker-compose.yml是compose默认查找的文件,使用下面的命令,所有的服务将使用后台模式被启动
使用-f
指定代替的compose文件
使用-p
指定代替compose文件所在的目录
docker-compose up -d jenkins #也可以指定 docker-compose.yml中某一个服务运行
5.5 验证启动的服务
这里提供了一个整合的列表显示所有启动的服务和容器
5.6 通常使用docker ps
命令来验证应用的容器,和在Docker主机上运行的其他容器
5.7 停止服务
5.8 查看日志
[root@linux-node1 devops]# docker-compose logs Attaching to devops_jenkins_2, devops_gitlab_1, devops_sonarqube_1, devops_jenkins_1 gitlab_1 | Thank you for using GitLab Docker Image! gitlab_1 | Current version: gitlab-ce=10.2.1-ce.0 gitlab_1 | gitlab_1 | Configure GitLab for your system by editing /etc/gitlab/gitlab.rb file gitlab_1 | And restart this container to reload settings. gitlab_1 | To do it use docker exec: gitlab_1 | gitlab_1 | docker exec -it gitlab vim /etc/gitlab/gitlab.rb gitlab_1 | docker restart gitlab gitlab_1 | gitlab_1 | For a comprehensive list of configuration options please see the Omnibus GitLab readme gitlab_1 | https://gitlab.com/gitlab-org/omnibus-gitlab/blob/master/README.md gitlab_1 | gitlab_1 | If this container fails to start due to permission problems try to fix it by executing: gitlab_1 | gitlab_1 | docker exec -it gitlab update-permissions gitlab_1 | docker restart gitlab gitlab_1 | gitlab_1 | Installing gitlab.rb config... gitlab_1 | Generating ssh_host_rsa_key... gitlab_1 | Generating public/private rsa key pair. gitlab_1 | Your identification has been saved in /etc/gitlab/ssh_host_rsa_key. gitlab_1 | Your public key has been saved in /etc/gitlab/ssh_host_rsa_key.pub. gitlab_1 | The key fingerprint is: gitlab_1 | SHA256:ruov5EXSS62oUDR+gNbdN+JfxsHLHvBtkqBJTZ0rSVw root@99c7c0d5732d gitlab_1 | The key\'s randomart image is: gitlab_1 | +---[RSA 2048]----+ gitlab_1 | | .. . . +.+E. | gitlab_1 | |..+. . + O = | gitlab_1 | |.o o .o.* O * | gitlab_1 | | o o ++.o % o | gitlab_1 | | . . = oS = + | gitlab_1 | |. o +. . . | gitlab_1 | | . + . . | gitlab_1 | | . o . | gitlab_1 | | .o+o | gitlab_1 | +----[SHA256]-----+ gitlab_1 | Generating ssh_host_ecdsa_key... gitlab_1 | Generating public/private ecdsa key pair. gitlab_1 | Your identification has been saved in /etc/gitlab/ssh_host_ecdsa_key. gitlab_1 | Your public key has been saved in /etc/gitlab/ssh_host_ecdsa_key.pub. gitlab_1 | The key fingerprint is: gitlab_1 | SHA256:1vcxaXrHEjGYlS1v8DJaIJLlsgI2xDpWyycW/rf6kN8 root@99c7c0d5732d gitlab_1 | The key\'s randomart image is: gitlab_1 | +---[ECDSA 256]---+ gitlab_1 | | .. o. .o | gitlab_1 | | .+ o.. .++ .| gitlab_1 | | =+o ....o.o= | gitlab_1 | | +.*o. + +++| gitlab_1 | | . o +. S . .o*+ | gitlab_1 | | .+. ..+ = | gitlab_1 | | o. . . + o| gitlab_1 | | o.. . o | gitlab_1 | | .oo E | gitlab_1 | +----[SHA256]-----+ gitlab_1 | Generating ssh_host_ed25519_key... gitlab_1 | Generating public/private ed25519 key pair. gitlab_1 | Your identification has been saved in /etc/gitlab/ssh_host_ed25519_key. gitlab_1 | Your public key has been saved in /etc/gitlab/ssh_host_ed25519_key.pub. gitlab_1 | The key fingerprint is: gitlab_1 | SHA256:9fYaA1KqoJMOHu04ln5VyytmiXYnlR29b37DJDf/7MY root@99c7c0d5732d gitlab_1 | The key\'s randomart image is: gitlab_1 | +--[ED25519 256]--+ gitlab_1 | | | gitlab_1 | | | gitlab_1 | | + | gitlab_1 | | . = o | gitlab_1 | | . o S o + | gitlab_1 | | .o o * o + o + | gitlab_1 | |..=.o + . + *.o| gitlab_1 | |.*+= B o * =E| gitlab_1 | |o+=.+ + +..o*| gitlab_1 | +----[SHA256]-----+ gitlab_1 | Preparing services... gitlab_1 | Starting services... gitlab_1 | Configuring GitLab package... gitlab_1 | /opt/gitlab/embedded/bin/runsvdir-start: line 24: ulimit: pending signals: cannot modify limit: Operation not permitted gitlab_1 | /opt/gitlab/embedded/bin/runsvdir-start: line 37: /proc/sys/fs/file-max: Read-only file system gitlab_1 | gitlab preinstall: gitlab_1 | gitlab preinstall: This node does not appear to be running a database gitlab_1 | gitlab preinstall: Skipping version check, if you think this is an error exit now gitlab_1 | gitlab preinstall: gitlab_1 | Configuring GitLab... gitlab_1 | gitlab_1 | gitlab_1 | * Moving existing certificates found in /opt/gitlab/embedded/ssl/certs gitlab_1 | gitlab_1 | * Symlinking existing certificates found in /etc/gitlab/trusted-certs gitlab_1 | Thank you for using GitLab Docker Image! gitlab_1 | Current version: gitlab-ce=10.2.1-ce.0 gitlab_1 | gitlab_1 | Configure GitLab for your system by editing /etc/gitlab/gitlab.rb file gitlab_1 | And restart this container to reload settings. gitlab_1 | To do it use docker exec: gitlab_1 | gitlab_1 | docker exec -it gitlab vim /etc/gitlab/gitlab.rb gitlab_1 | docker restart gitlab gitlab_1 | gitlab_1 | For a comprehensive list of configuration options please see the Omnibus GitLab readme gitlab_1 | https://gitlab.com/gitlab-org/omnibus-gitlab/blob/master/README.md gitlab_1 | gitlab_1 | If this container fails to start due to permission problems try to fix it by executing: gitlab_1 | gitlab_1 | docker exec -it gitlab update-permissions gitlab_1 | docker restart gitlab gitlab_1 | gitlab_1 | Preparing services... gitlab_1 | Starting services... gitlab_1 | Configuring GitLab package... gitlab_1 | /opt/gitlab/embedded/bin/runsvdir-start: line 24: ulimit: pending signals: cannot modify limit: Operation not permitted gitlab_1 | /opt/gitlab/embedded/bin/runsvdir-start: line 37: /proc/sys/fs/file-max: Read-only file system gitlab_1 | gitlab preinstall: gitlab_1 | gitlab preinstall: This node does not appear to be running a database gitlab_1 | gitlab preinstall: Skipping version check, if you think this is an error exit now gitlab_1 | gitlab preinstall: gitlab_1 | Configuring GitLab... jenkins_1 | Running from: /usr/share/jenkins/jenkins.war jenkins_1 | webroot: EnvVars.masterEnvVars.get("JENKINS_HOME") jenkins_1 | Nov 25, 2017 9:33:33 PM Main deleteWinstoneTempContents jenkins_1 | WARNING: Failed to delete the temporary Winstone file /tmp/winstone/jenkins.war jenkins_1 | Nov 25, 2017 9:33:34 PM org.eclipse.jetty.util.log.JavaUtilLog info jenkins_1 | INFO: Logging initialized @4345ms jenkins_1 | Nov 25, 2017 9:33:34 PM winstone.Logger logInternal jenkins_1 | INFO: Beginning extraction from war file jenkins_1 | Nov 25, 2017 9:33:34 PM org.eclipse.jetty.util.log.JavaUtilLog warn jenkins_1 | WARNING: Empty contextPath jenkins_1 | Nov 25, 2017 9:33:34 PM org.eclipse.jetty.util.log.JavaUtilLog info jenkins_1 | INFO: jetty-9.2.z-SNAPSHOT jenkins_1 | Nov 25, 2017 9:33:38 PM org.eclipse.jetty.util.log.JavaUtilLog info jenkins_1 | INFO: NO JSP Support for /, did not find org.eclipse.jetty.jsp.JettyJspServlet jenkins_1 | Jenkins home directory: /var/jenkins_home found at: EnvVars.masterEnvVars.get("JENKINS_HOME") jenkins_1 | Nov 25, 2017 9:33:43 PM org.eclipse.jetty.util.log.JavaUtilLog info jenkins_1 | INFO: Started w.@173ed316{/,file:/var/jenkins_home/war/,AVAILABLE}{/var/jenkins_home/war} jenkins_1 | Nov 25, 2017 9:33:44 PM org.eclipse.jetty.util.log.JavaUtilLog info jenkins_1 | INFO: Started ServerConnector@53fb3dab{HTTP/1.1}{0.0.0.0:8080} jenkins_1 | Nov 25, 2017 9:33:44 PM org.eclipse.jetty.util.log.JavaUtilLog info jenkins_1 | INFO: Started @14237ms jenkins_1 | Nov 25, 2017 9:33:44 PM winstone.Logger logInternal jenkins_1 | INFO: Winstone Servlet Engine v2.0 running: controlPort=disabled jenkins_1 | Nov 25, 2017 9:33:46 PM jenkins.InitReactorRunner$1 onAttained jenkins_1 | INFO: Started initialization jenkins_1 | Nov 25, 2017 9:33:55 PM jenkins.InitReactorRunner$1 onAttained jenkins_1 | INFO: Listed all plugins jenkins_1 | Nov 25, 2017 9:34:29 PM jenkins.InitReactorRunner$1 onAttained jenkins_1 | INFO: Prepared all plugins jenkins_1 | Nov 25, 2017 9:34:29 PM jenkins.InitReactorRunner$1 onAttained jenkins_1 | INFO: Started all plugins jenkins_1 | Nov 25, 2017 9:34:38 PM hudson.ExtensionFinder$GuiceFinder$FaultTolerantScope$1 error jenkins_1 | INFO: Failed to instantiate optional component hudson.plugins.build_timeout.operations.AbortAndRestartOperation$DescriptorImpl; skipping jenkins_1 | Nov 25, 2017 9:34:39 PM jenkins.InitReactorRunner$1 onAttained jenkins_1 | INFO: Augmented all extensions jenkins_1 | Nov 25, 2017 9:34:41 PM jenkins.InitReactorRunner$1 onAttained jenkins_1 | INFO: Loaded all jobs jenkins_1 | Nov 25, 2017 9:34:41 PM hudson.model.AsyncPeriodicWork$1 run jenkins_1 | INFO: Started Download metadata jenkins_1 | Nov 25, 2017 9:34:41 PM jenkins.util.groovy.GroovyHookScript execute jenkins_1 | INFO: Executing /var/jenkins_home/init.groovy.d/tcp-slave-agent-port.groovy jenkins_1 | Nov 25, 2017 9:34:45 PM jenkins.InitReactorRunner$1 onAttained jenkins_1 | INFO: Completed initialization jenkins_1 | Nov 25, 2017 9:34:45 PM org.springframework.context.support.AbstractApplicationContext prepareRefresh jenkins_1 | INFO: Refreshing org.springframework.web.context.support.StaticWebApplicationContext@a119ee: display name [Root WebApplicationContext]; startup date [Sat Nov 25 21:34:45 UTC 2017]; root of context hierarchy jenkins_1 | Nov 25, 2017 9:34:45 PM org.springframework.context.support.AbstractApplicationContext obtainFreshBeanFactory jenkins_1 | INFO: Bean factory for application context [org.springframework.web.context.support.StaticWebApplicationContext@a119ee]: org.springframework.beans.factory.support.DefaultListableBeanFactory@22fb6b1 jenkins_1 | Nov 25, 2017 9:34:45 PM org.springframework.beans.factory.support.DefaultListableBeanFactory preInstantiateSingletons jenkins_1 | INFO: Pre-instantiating singletons in org.springframework.beans.factory.support.DefaultListableBeanFactory@22fb6b1: defining beans [authenticationManager]; root of factory hierarchy jenkins_1 | Nov 25, 2017 9:34:46 PM org.springframework.context.support.AbstractApplicationContext prepareRefresh jenkins_1 | INFO: Refreshing org.springframework.web.context.support.StaticWebApplicationContext@2ef02173: display name [Root WebApplicationContext]; startup date [Sat Nov 25 21:34:46 UTC 2017]; root of context hierarchy jenkins_1 | Nov 25, 2017 9:34:46 PM org.springframework.context.support.AbstractApplicationContext obtainFreshBeanFactory jenkins_1 | INFO: Bean factory for application context [org.springframework.web.context.support.StaticWebApplicationContext@2ef02173]: org.springframework.beans.factory.support.DefaultListableBeanFactory@21d20e75 jenkins_1 | Nov 25, 2017 9:34:46 PM org.springframework.beans.factory.support.DefaultListableBeanFactory preInstantiateSingletons jenkins_1 | INFO: Pre-instantiating singletons in org.springframework.beans.factory.support.DefaultListableBeanFactory@21d20e75: defining beans [filter,legacy]; root of factory hierarchy jenkins_1 | Nov 25, 2017 9:34:49 PM hudson.WebAppMain$3 run jenkins_1 | INFO: Jenkins is fully up and running sonarqube_1 | 2017.11.26 09:47:25 INFO app[][o.s.a.AppFileSystem] Cleaning or creating temp directory /opt/sonarqube/temp sonarqube_1 | 2017.11.26 09:47:27 INFO app[][o.s.a.es.EsSettings] Elasticsearch listening on /127.0.0.1:9001 jenkins_1 | Nov 25, 2017 9:34:53 PM hudson.model.UpdateSite updateData jenkins_1 | INFO: Obtained the latest update center data file for UpdateSource default jenkins_1 | --> setting agent port for jnlp jenkins_1 | --> setting agent port for jnlp... done jenkins_1 | Nov 25, 2017 9:34:57 PM hudson.model.DownloadService$Downloadable load jenkins_1 | INFO: Obtained the updated data file for hudson.tasks.Maven.MavenInstaller jenkins_1 | Nov 25, 2017 9:34:58 PM hudson.model.DownloadService$Downloadable load sonarqube_1 | 2017.11.26 09:47:29 INFO app[][o.s.a.p.ProcessLauncherImpl] Launch process[[key=\'es\', ipcIndex=1, logFilenamePrefix=es]] from [/opt/sonarqube/elasticsearch]: /opt/sonarqube/elasticsearch/bin/elasticsearch -Epath.conf=/opt/sonarqube/temp/conf/es sonarqube_1 | 2017.11.26 09:47:30 INFO app[][o.s.a.SchedulerImpl] Waiting for Elasticsearch to be up and running sonarqube_1 | 2017.11.26 09:47:46 INFO app[][o.e.p.PluginsService] no modules loaded sonarqube_1 | 2017.11.26 09:47:46 INFO app[][o.e.p.PluginsService] loaded plugin [org.elasticsearch.transport.Netty4Plugin] sonarqube_1 | 2017.11.26 09:50:14 INFO app[][o.s.a.SchedulerImpl] Process[es] is up sonarqube_1 | 2017.11.26 09:50:15 INFO app[][o.s.a.p.ProcessLauncherImpl] Launch process[[key=\'web\', ipcIndex=2, logFilenamePrefix=web]] from [/opt/sonarqube]: /usr/lib/jvm/java-8-openjdk-amd64/jre/bin/java -Djava.awt.headless=true -Dfile.encoding=UTF-8 -Djava.io.tmpdir=/opt/sonarqube/temp -Xmx512m -Xms128m -XX:+HeapDumpOnOutOfMemoryError -Djava.security.egd=file:/dev/./urandom -cp ./lib/common/*:./lib/server/*:/opt/sonarqube/lib/jdbc/h2/h2-1.3.176.jar org.sonar.server.app.WebServer /opt/sonarqube/temp/sq-process2006673090366779016properties sonarqube_1 | 2017.11.26 09:51:48 INFO web[][o.s.p.ProcessEntryPoint] Starting web sonarqube_1 | 2017.11.26 09:52:07 INFO web[][o.a.t.u.n.NioselectorPool] Using a shared selector for servlet write/read sonarqube_1 | 2017.11.26 09:52:50 INFO web[][o.e.p.PluginsService] no modules loaded sonarqube_1 | 2017.11.26 09:52:50 INFO web[][o.e.p.PluginsService] loaded plugin [org.elasticsearch.index.reindex.ReindexPlugin] jenkins_1 | INFO: Obtained the updated data file for hudson.tasks.Ant.AntInstaller jenkins_1 | Nov 25, 2017 9:35:00 PM hudson.model.DownloadService$Downloadable load jenkins_1 | INFO: Obtained the updated data file for hudson.plugins.gradle.GradleInstaller jenkins_1 | Nov 25, 2017 9:35:14 PM hudson.model.DownloadService$Downloadable load jenkins_1 | INFO: Obtained the updated data file for hudson.tools.JDKInstaller jenkins_1 | Nov 25, 2017 9:35:14 PM hudson.model.AsyncPeriodicWork$1 run sonarqube_1 | 2017.11.26 09:52:50 INFO web[][o.e.p.PluginsService] loaded plugin [org.elasticsearch.join.ParentJoinPlugin] jenkins_1 | INFO: Finished Download metadata. 32,878 ms jenkins_1 | Nov 26, 2017 1:21:51 AM hudson.slaves.SlaveComputer tryReconnect sonarqube_1 | 2017.11.26 09:52:50 INFO web[][o.e.p.PluginsService] loaded plugin [org.elasticsearch.percolator.PercolatorPlugin] sonarqube_1 | 2017.11.26 09:52:50 INFO web[][o.e.p.PluginsService] loaded plugin [org.elasticsearch.transport.Netty4Plugin] sonarqube_1 | 2017.11.26 09:53:58 INFO web[][o.s.s.e.EsClientProvider] Connected to local Elasticsearch: [127.0.0.1:9001] sonarqube_1 | 2017.11.26 09:53:59 INFO web[][o.s.s.p.LogServerVersion] SonarQube Server / 6.7.0.33306 / 5d031d9d2ac3f69b4b9bc600d50563b1886c7d8b sonarqube_1 | 2017.11.26 09:54:02 INFO web[][o.s.s.p.d.EmbeddedDatabase] Starting embedded database on port 9092 with url jdbc:h2:tcp://127.0.0.1:9092/sonar sonarqube_1 | 2017.11.26 09:54:03 INFO web[][o.s.s.p.d.EmbeddedDatabase] Embedded database started. Data stored in: /opt/sonarqube/data sonarqube_1 | 2017.11.26 09:54:03 INFO web[][o.sonar.db.Database] Create JDBC data source for jdbc:h2:tcp://127.0.0.1:9092/sonar sonarqube_1 | 2017.11.26 09:54:04 WARN web[][o.s.d.DatabaseChecker] H2 database should be used for evaluation purpose only sonarqube_1 | 2017.11.26 09:54:16 INFO web[][o.s.s.p.ServerFileSystemImpl] SonarQube home: /opt/sonarqube sonarqube_1 | 2017.11.26 09:54:16 INFO web[][o.s.s.u.SystemPasscodeImpl] System authentication by passcode is disabled sonarqube_1 | 2017.11.26 09:54:18 INFO web[][o.s.s.p.d.m.h.MigrationHistoryTableImpl] Creating table schema_migrations sonarqube_1 | 2017.11.26 09:54:21 INFO web[][o.s.s.p.ServerPlu以上是关于Docker安装和使用的主要内容,如果未能解决你的问题,请参考以下文章
markdown [Docker] Docker片段列表和命令#linux #docker #snippets