gitlab http clone url is wrong,port 8022 missing - docker

I use docker install gitlab.
Step 1:
docker run -d
-p 8023:443
-p 8020:80
-p 8022:22
--name gitlab
--restart always
-v /home/gitlab/config:/etc/gitlab
-v /home/gitlab/logs:/var/log/gitlab
-v /home/gitlab/data:/var/opt/gitlab
gitlab/gitlab-ce
step 2:
vi /home/gitlab/config/gitlab.rb
external_url 'http://192.168.71.5'
gitlab_rails['gitlab_ssh_host'] = '192.168.71.5'
gitlab_rails['gitlab_shell_ssh_port'] = 8022
step 3:
docker exec -it gitlab /bin/bash
gitlab-ctl reconfigure
docker restart gitlab
When I add a new project new-test in gitlab.
Then open http://192.168.71.5:8020/root/new-test with chrome.
The Clone with HTTP is http://192.168.71.5/root/new-test.git.
when use git clone http://192.168.71.5/root/new-test.git. There is something wrong.
fatal: unable to access 'http://192.168.71.5/root/new-test.git/': Failed connect to 192.168.71.5:80; Connection refused
enter image description here
why the Clone with HTTP is not http://192.168.71.5:8022/root/new-test.git?

-p 8023:443
-p 8020:80
-p 8022:22
should be
docker run -d
-p 443:8023
-p 80:8020
-p 22:8022

You have to change the value of 'external_url' in gitlab.rb to include the portnumber. This will also be reflected in the http(s) clone url.
Note that in the last scentence of your question you use port 8022 (which is the ssh port). This probably should be 8020.
Pay attention that when changing the value of 'external_url', this will cause nginx to start listening on this same port. So you have to configure the ports of your docker container like the following:
-p 8023:443
-p 8020:8020
-p 8022:22

Related

Docker Local Registry run from different port

I installed Docker Local Registry as below
docker pull registry
after
docker run -d -p 5001:5001 -v C:/localhub/registry:/var/lib/registry --restart=always --name hub.local registry
because of 5000 port using another application.
but i can't reach to
http://localhost:5001/v2/_catalog
The first part of the -p value is the host port and the second part is the port within the container.
This code runs the registry on port 5001
docker run -d -p 5001:5000 --name hub.local registry
If you want to change the port the registry listens on within the container, you must use this code
docker run -d -e REGISTRY_HTTP_ADDR=0.0.0.0:5001 -p 5001:5001 --name hub.local registry
'''
docker run -d -p 5001:5000 -v C:/localhub/registry:/var/lib/registry --restart=always --name hub.local registry
'''
Keep the internal port the same and change only your local port

Mosquitto broker won't restart with Docker on Raspberry reboot

I installed Mosquitto broker with Docker on Raspbian this way:
docker pull eclipse-mosquitto
docker run -d -p 1883:1883 -p 9001:9001 --name=mosquitto eclipse-mosquitto --restart=always
When I reboot the Raspberry, the container seems that is not running and I cannot connect to it. If I try to run it again I get:
docker: Error response from daemon: Conflict. The container name
"/mosquitto" is already in use by container
"3187ab53a3a2067b9d6ce0sa647a8d90cb52485f5540ca4eacad1c4e662ffa9d". You have
to remove (or rename) that container to be able to reuse that name.
See 'docker run --help'.
So I need to remove it
docker rm -f mosquitto
and restart it again.
What I miss?
Docker Engine prevents two containers from having the same name.
So if you run twice the command like this:
docker run -d -p 1883:1883 -p 9001:9001 --name=mosquitto eclipse-mosquitto
docker stop mosquitto # simulates your reboot
docker run -d -p 1883:1883 -p 9001:9001 --name=mosquitto eclipse-mosquitto
Then the second attempt will fail, as you noticed.
Actually, I guess that you had put the option --restart=always in the wrong place. (More precisely, the arguments given after the image name are not seen as Docker CLI options, they are provided to the entrypoint: docker run [OPTIONS] image-name [ARGUMENTS])
Could you try this (and reboot)?
docker run -d -p 1883:1883 -p 9001:9001 --name=mosquitto --restart=always eclipse-mosquitto
Otherwise, you could just as well do:
docker start eclipse-mosquitto
after a docker stop or a reboot that wouldn't succeed in restarting the container.

How to configure jenkins run on port 80 use docker?

i use below command , but it doesn't work, we must use --ip to pass ip to pass given ip to docker
docker run -p 80:80080 --ip xx.xx.xx.xx jenkins
finnally i have resloved with add an environment parameter with docker command
-e JENKINS_OPTS="--httpPort=80"
docker run -p 80:8080 -d jenkins/jenkins:latest
docker run --name jenkinsci -p 8081:8080 jenkins/jenkins:lts
If 8080 is already in use, you can use 8081 but forward it to 8080, as jenkins starts on 8080
-p 8081:8080

cannot run container after commit changes

Just basic and simple steps illustrating what I have tried:
docker pull mysql/mysql-server
sudo docker run -i -t mysql/mysql-server:latest /bin/bash
yum install vi
vi /etc/my.cnf -> bind-address=0.0.0.0
exit
docker ps
docker commit new_image_name
docker run --name mysql -p 3306:3306 -e MYSQL_ROOT_PASSWORD=secret -d new_image_name
docker ps -a STATUS - Exited (1)
Please let me know what I did wrong.
Instead of trying to modify an existing image, try and use (for testing) MYSQL_ROOT_HOST=%.
That would allow root login from any IP. (As seen in docker-library/mysql issue 241)
sudo docker run --name mysql -p 3306:3306 -e MYSQL_ROOT_PASSWORD=123456 -e MYSQL_ROOT_HOST=% -d mysql/mysql-server:latest
The README mentions:
By default, MySQL creates the 'root'#'localhost' account.
This account can only be connected to from inside the container, requiring the use of the docker exec command as noted under Connect to MySQL from the MySQL Command Line Client.
To allow connections from other hosts, set this environment variable.
As an example, the value "172.17.0.1", which is the default Docker gateway IP, will allow connections from the Docker host machine.

Need to create listener for docker plugin on Jenkins on port 2375

I am trying to use the following docker command to create a jenkins container server along with enabling the docker api for the docker plugin.
docker run --name myjenkins -p 8080:8080 -d -p 50000:50000 -v /var/jenkins_home -H tcp://127.0.0.1:2375 jenkins
Unfortunately i am getting the below error message which indicates the -H flag isn't allowed on docker run
`unknown shorthand flag: 'H' in -H
See 'docker run --help'.`
Any ideas on what to do in order to create this listener?

Resources