[root@fieldyang01 var]# docker run -it --name jenkins -p 8080:8080 --restart=always -e TZ="Asia/Shanghai" -e JENKINS_OPTS="--prefix=/jenkins" -v "$PWD":/var/jenkins_home jenkins/jenkins
touch: cannot touch '/var/jenkins_home/copy_reference_file.log': Permission denied
Can not write to /var/jenkins_home/copy_reference_file.log. Wrong volume permissions?
[root@fieldyang01 var]# docker ps -a
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
1643d57a5d22 jenkins/jenkins "/sbin/tini -- /us..." 35 seconds ago Up Less than a second 0.0.0.0:8080->8080/tcp, 50000/tcp jenkins
3a2a62fa9215 nginx:alpine "nginx -g 'daemon ..." 15 hours ago Up 14 hours 0.0.0.0:1080->80/tcp nginx
f2bbb060b89e gogs/gogs "/app/gogs/docker/..." 15 hours ago Up 15 hours 0.0.0.0:3000->3000/tcp, 0.0.0.0:3022->22/tcp gogs
6ffb685c8e91 mysql:5.6 "docker-entrypoint..." 2 days ago Up 2 days 3306/tcp db01
aa658f0d7269 centos:6.8 "/bin/bash" 4 days ago Exited (255) 3 days ago centos
f21ba87f00f9 ubuntu:14.04 "/bin/bash" 4 days ago Exited (0) 4 days ago ubuntu
[root@fieldyang01 var]# docker rm -f 1643d57a5d22
1643d57a5d22
[root@fieldyang01 var]#
[root@fieldyang01 var]#
[root@fieldyang01 var]# docker run -d --name jenkins -p 8080:8080 --restart=always -e TZ="Asia/Shanghai" -e JENKINS_OPTS="--prefix=/jenkins" -v /root/yangzw/docker/jenkins:/var jenkins/jenkins
b085cca747456d435dfcc7edd8d3cb2855a35ce1bb249417af463811177d7236
[root@fieldyang01 var]# docker ps -a
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
b085cca74745 jenkins/jenkins "/sbin/tini -- /us..." 3 seconds ago Up 2 seconds 0.0.0.0:8080->8080/tcp, 50000/tcp jenkins
3a2a62fa9215 nginx:alpine "nginx -g 'daemon ..." 15 hours ago Up 14 hours 0.0.0.0:1080->80/tcp nginx
f2bbb060b89e gogs/gogs "/app/gogs/docker/..." 15 hours ago Up 15 hours 0.0.0.0:3000->3000/tcp, 0.0.0.0:3022->22/tcp gogs
6ffb685c8e91 mysql:5.6 "docker-entrypoint..." 2 days ago Up 2 days 3306/tcp db01
aa658f0d7269 centos:6.8 "/bin/bash" 4 days ago Exited (255) 3 days ago centos
f21ba87f00f9 ubuntu:14.04 "/bin/bash" 4 days ago Exited (0) 4 days ago ubuntu
[root@fieldyang01 jenkins]# ls
jenkins_home
[root@fieldyang01 jenkins]# cd jenkins_home/
[root@fieldyang01 jenkins_home]# ls
[root@fieldyang01 nginx]# cat gogs.conf
server
{
listen 80;
server_name 172.17.0.4;
location / {
proxy_redirect off;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_pass http://172.17.0.2:3000;
}
location /jenkins/ {
# if ($args ~* from=%2Fjenkins%2F) {
# rewrite ^/jenkins/login(.*)$ https://$host permament;
#}
proxy_redirect off;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_pass http://172.17.0.5:8080;
}
}
[root@fieldyang01 nginx]#
[root@fieldyang01 ~]# docker restart nginx
[root@fieldyang01 nginx]# docker ps -a
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
816a32bc525d jenkins/jenkins "/sbin/tini -- /us..." About an hour ago Up About an hour 0.0.0.0:8080->8080/tcp, 50000/tcp jenkins
3a2a62fa9215 nginx:alpine "nginx -g 'daemon ..." 16 hours ago Up 21 minutes 0.0.0.0:1080->80/tcp nginx
f2bbb060b89e gogs/gogs "/app/gogs/docker/..." 17 hours ago Up 17 hours 0.0.0.0:3000->3000/tcp, 0.0.0.0:3022->22/tcp gogs
6ffb685c8e91 mysql:5.6 "docker-entrypoint..." 2 days ago Up 2 days 3306/tcp db01
aa658f0d7269 centos:6.8 "/bin/bash" 4 days ago Exited (255) 3 days ago centos
f21ba87f00f9 ubuntu:14.04 "/bin/bash" 4 days ago Exited (0) 4 days ago ubuntu
[root@fieldyang01 nginx]#
[root@fieldyang01 nginx]# curl http://192.168.2.111:1080/jenkins/
Authentication required
[root@fieldyang01 nginx]#
[root@fieldyang01 nginx]# wget http://192.168.2.111:1080/jenkins/
--2020-03-12 03:58:22-- http://192.168.2.111:1080/jenkins/
Connecting to 192.168.2.111:1080... connected.
HTTP request sent, awaiting response... 403 Forbidden
2020-03-12 03:58:22 ERROR 403: Forbidden.
[root@fieldyang01 nginx]# curl http://192.168.2.111:1080/jenkins/
Authentication required
[root@fieldyang01 nginx]#
[root@fieldyang01 nginx]#
[root@fieldyang01 nginx]# docker logs 3a2a62fa9215
...
nginx: [warn] conflicting server name "172.17.0.4" on 0.0.0.0:80, ignored
192.168.2.101 - - [12/Mar/2020:07:37:29 +0000] "GET /jenkins/ HTTP/1.1" 403 713 "-" "Mozilla/5.0 (Windows NT 6.1; Win64; x64; rv:73.0) Gecko/20100101 Firefox/73.0" "-"
192.168.2.101 - - [12/Mar/2020:07:37:29 +0000] "GET /jenkins/login?from=%2Fjenkins%2F HTTP/1.1" 200 1702 "http://192.168.2.111:1080/jenkins/" "Mozilla/5.0 (Windows NT 6.1; Win64; x64; rv:73.0) Gecko/20100101 Firefox/73.0" "-"
192.168.2.101 - - [12/Mar/2020:07:37:30 +0000] "GET /jenkins/static/250f6d5a/scripts/yui/container/assets/container.css HTTP/1.1" 499 0 "http://192.168.2.111:1080/jenkins/login?from=%2Fjenkins%2F" "Mozilla/5.0 (Windows NT 6.1; Win64; x64; rv:73.0) Gecko/20100101 Firefox/73.0" "-"
[root@fieldyang01 nginx]#
[root@fieldyang01 nginx]# docker logs 816a32bc525d
2020-03-12 07:51:37.175+0000 [id=97] INFO h.model.UpdateCenter$DownloadJob#run: Starting the installation of timestamper on behalf of admin
2020-03-12 07:51:38.789+0000 [id=97] INFO h.m.UpdateCenter$UpdateCenterConfiguration#download: Downloading timestamper
2020-03-12 07:52:32.021+0000 [id=97] INFO h.model.UpdateCenter$DownloadJob#run: Installation successful: timestamper
2020-03-12 07:52:32.021+0000 [id=97] INFO h.model.UpdateCenter$DownloadJob#run: Starting the installation of workflow-support on behalf of admin
2020-03-12 07:52:36.169+0000 [id=97] INFO h.m.UpdateCenter$UpdateCenterConfiguration#download: Downloading workflow-support
2020-03-12 07:53:13.431+0000 [id=97] INFO h.model.UpdateCenter$DownloadJob#run: Installation successful: workflow-support
2020-03-12 07:53:13.432+0000 [id=97] INFO h.model.UpdateCenter$DownloadJob#run: Starting the installation of durable-task on behalf of admin
2020-03-12 07:53:15.116+0000 [id=97] INFO h.m.UpdateCenter$UpdateCenterConfiguration#download: Downloading durable-task
[root@fieldyang01 nginx]#