Run Jenkins on different port on a docker container - docker

I'm trying to run Jenkins on docker by using a different port. By default Jenkins is running on port 8080, but this port is used by different service in my machine. I would like to run Jenkins on a different port.
I have used the following command without any success:
docker run \
-u root \
--rm \
-d \
--name jenkins \
-p 8081:8081 \
-p 50000:50000 \
--env JAVA_OPTS="--httpPort=8081" \
-v jenkins-data:/var/jenkins_home \
-v /var/run/docker.sock:/var/run/docker.sock \
jenkinsci/blueocean
Any ideas?

--env JAVA_OPTS="--httpPort=8081" \
not JAVA_OPTS, change it like this:
-e JENKINS_OPTS="--httpPort=8081"

Use this:
docker run \
-u root \
--rm \
-d \
--name jenkins \
-p 8081:8080 \
-p 50000:50000 \
-v jenkins-data:/var/jenkins_home \
-v /var/run/docker.sock:/var/run/docker.sock \
jenkinsci/blueocean

Related

installing transmission on debian with docker: Missing container [duplicate]

This question already has answers here:
Why docker container exits immediately
(16 answers)
Closed 9 months ago.
I am new to this. I have installed docker on my Raspi. I am trying to install transmission on the docker. I use the following;
docker run --cap-add=NET_ADMIN -d \
--name=transmission \
-v /mnt/extDrive1:/data \
-v /etc/localtime:/etc/localtime:ro \
-e CREATE_TUN_DEVICE=true \
-e OPENVPN_PROVIDER=EXPRESSVPN \
-e OPENVPN_CONFIG=my_expressvpn_uk_-_london_udp \
-e OPENVPN_USERNAME=XXX\
-e OPENVPN_PASSWORD=XXX \
-e WEBPROXY_ENABLED=false \
-e LOCAL_NETWORK=192.168.0.0 \
--log-driver json-file \
--log-opt max-size=10m \
-p 9091:9091 \
haugene/transmission-openvpn
I go through the debug on https://haugene.github.io/docker-transmission-openvpn/debug/
All is fine until I get to the section 'Checking if Transmission is running'.
When I run docker ps, there are no containers in the list.
What have I done wrong? Ultimately, I am trying to access transmission through localhost:9091.
Edit: So I have made some progress, but still having issues;
docker start transmission temporarily. populates the container ID
docker exec -it <container-id> bash comes up with the following error:
Error response from daemon: Container XXXX is not running
It seems that container is exiting out as you are not running it in the detached mode. Try this:
docker run -itd --cap-add=NET_ADMIN -d \
--name=transmission \
-v /mnt/extDrive1:/data \
-v /etc/localtime:/etc/localtime:ro \
-e CREATE_TUN_DEVICE=true \
-e OPENVPN_PROVIDER=EXPRESSVPN \
-e OPENVPN_CONFIG=my_expressvpn_uk_-_london_udp \
-e OPENVPN_USERNAME=XXX\
-e OPENVPN_PASSWORD=XXX \
-e WEBPROXY_ENABLED=false \
-e LOCAL_NETWORK=192.168.0.0 \
--log-driver json-file \
--log-opt max-size=10m \
-p 9091:9091 \
haugene/transmission-openvpn

"docker: invalid reference format" while trying to install external plugin

My goal is simple: Load a hello-world external plugin for Kong. I've decided to do this via mounted volume, but am running into significant problems that stop me from being able to run my simple hello-world external plugin.
I've isolated my problem down to the following commands, from scratch:
docker network create kong-net
docker run -d --name kong-database \
--network=kong-net \
-p 5432:5432 \
-e "POSTGRES_USER=kong" \
-e "POSTGRES_DB=kong" \
-e "POSTGRES_PASSWORD=kong" \
postgres:9.6
docker run --rm \
--network=kong-net \
-e "KONG_DATABASE=postgres" \
-e "KONG_PG_HOST=kong-database" \
-e "KONG_PG_PASSWORD=kong" \
-e "KONG_CASSANDRA_CONTACT_POINTS=kong-database" \
kong:latest kong migrations bootstrap
docker run -it --name kong \
--network=kong-net \
-e "KONG_DATABASE=postgres" \
-e "KONG_PG_HOST=kong-database" \
-e "KONG_PG_PASSWORD=kong" \
-e "KONG_CASSANDRA_CONTACT_POINTS=kong-database" \
-e "KONG_LUA_PACKAGE_PATH=/plugins/?.lua" \
-e "KONG_CUSTOM_PLUGINS=helloworld" \
-e "KONG_PROXY_ACCESS_LOG=/dev/stdout" \
-e "KONG_ADMIN_ACCESS_LOG=/dev/stdout" \
-e "KONG_PROXY_ERROR_LOG=/dev/stderr" \
-e "KONG_ADMIN_ERROR_LOG=/dev/stderr" \
-e "KONG_ADMIN_LISTEN=0.0.0.0:8001, 0.0.0.0:8444 ssl" \
-v "kong/plugins/helloworld:/plugins" \
-p 8000:8000 \
-p 8443:8443 \
-p 8001:8001 \
-p 8444:8444 \
kong:latest
In my local directory, I have the plugin source code sitting in ./kong/plugins/helloworld/
According to the Kong docs, I'm adjusting my Kong config file by adding "KONG_" prior to the item I want adjusted. This means I have KONG_CUMSTOM_PLUGINS=helloworld and KONG_LUA_PACKAGE_PATH=/plugins/?.lua
Docker and Kong doesn't like this, and when running the above commands I am greeted with the following:
docker: invalid reference format.
See 'docker run --help'.
Eliminating things one-by-one, the problem surrounds both the -e "KONG_CUSTON_PLUGINS=helloworld" and -e "KONG_LUA_PACKAGE_PATH=/plugins/?.lua" \ bits.
What's going wrong here?

Can't ssh into docker container

I'm trying to run an openssh-server container and then connect to it:
docker run \
--name=openssh-server \
-p 22:22 \
-e USER_PASSWORD=123 \
-e USER_NAME=testuser \
--restart unless-stopped \
linuxserver/openssh-server
ssh testuser#localhost
The problem I'm having is that I keep getting the error ssh_exchange_identification: read: Connection reset by peer. What am I doing wrong?
Add -e PASSWORD_ACCESS=true in command to allow username/password ssh access and change -p 22:22 to 22:2222 as container always starts openssh on port 2222
Updated command is ::
docker run \
--name=openssh-server \
-p 22:2222 \
-e USER_PASSWORD=123 \
-e USER_NAME=testuser \
-e PASSWORD_ACCESS=true \
--restart unless-stopped \
linuxserver/openssh-server

Jenkins location in docker, not at /var/jenkins_home

I'm installing Jenkins via docker by following this official guide.
After running command:
docker run \
-u root \
--rm \
-d \
-p 8080:8080 \
-p 50000:50000 \
-v jenkins-data:/var/jenkins_home \
-v /var/run/docker.sock:/var/run/docker.sock \
jenkinsci/blueocean
I'm expecting Jenkins to be installed # /var/jenkins_home, but instead it is being installed # /var/lib/docker/volumes/jenkins-data.
Also there is no such folder as /var/jenkins_home.
Am I missing something. Please suggest.
Thank You
/var/jenkins_home is inside the container. You are using named volume & that's why it's located in /var/lib/docker/volumes/jenkins-data.
Instead, you can use host bind mounts as below to ensure you get the data in /var/jenkins_home on the host machine -
docker run \
-u root \
--rm \
-d \
-p 8080:8080 \
-p 50000:50000 \
-v /var/jenkins_home:/var/jenkins_home \
-v /var/run/docker.sock:/var/run/docker.sock \
jenkinsci/blueocean
Volumes path in case of host mounts has to be absolute else it results in creating a named volume.

How to add rabbitmq_delayed_message_exchange plugin to RabbitMQ running docker

I would like to add the "rabbitmq_delayed_message_exchange" plugin to my docker installation.
Also, I want the Plugin to stay there after I reboot the RabbitMQ container.
The installation script I use is:
docker run -d -h docker01.docker \
--add-host=docker01.docker:192.168.1.11 \
--name rabbit \
-p "4370:4370" \
-p "5672:5672" \
-p "15672:15672" \
-p "25672:25672" \
-p "35197:35197" \
-e "RABBITMQ_USE_LONGNAME=true" \
-e "ERL_EPMD_PORT=4370" \
-e RABBITMQ_ERLANG_COOKIE="rabbitcookie" \
-e RABBITMQ_NODENAME="master" \
-e "RABBITMQ_LOGS=/var/log/rabbitmq/rabbit.log" \
-v /data/rabbitmq:/var/lib/rabbitmq \
-v /data/rabbitmq/logs:/var/log/rabbitmq \
rabbitmq:3.6.6-management
Is it possible to add that plugin to this above installation?
Thanks

Resources