Raspberry PI cannot run gitlab image on docker - docker

I am trying to run docker image with gitlab on my Raspberry PI.
Versions:
Raspbian 10 (buster)
Docker 20.10.8, API 1.41
Gitlab CE 13.10.0-ce.0 from [this][1] image, ulm0/gitlab 12.7.2
I am using simply docker command to run gitlab:
sudo docker run --name gitlab \
-p 10080:80 -p 10022:22 -p 10443:443 \
-v /srv/gitlab/config:/etc/gitlab \
-v /srv/gitlab/logs:/var/log/gitlab \
-v /srv/gitlab/data:/var/opt/gitlab -v \
/srv/gitlab/logs/reconfigure:/var/log/gitlab/reconfigure \
ulm0/gitlab
After running a command, in sudo docker logs gitlab I've got something like this:
Configure GitLab for your system by editing /etc/gitlab/gitlab.rb file
And restart this container to reload settings.
To do it use docker exec:
docker exec -it gitlab vim /etc/gitlab/gitlab.rb
docker restart gitlab
For a comprehensive list of configuration options please see the Omnibus GitLab readme
https://gitlab.com/gitlab-org/omnibus-gitlab/blob/master/README.md
If this container fails to start due to permission problems try to fix it by executing:
docker exec -it gitlab update-permissions
docker restart gitlab
but after running docker exec -it gitlab update-permissions I've got this:
Error response from daemon: Container 110f1def3f669d8d180bf552aa63e50c0e4c857f8bd1ab2745a677454fef04b0
is restarting, wait until the container is running
when I ran command with permissions right after container stared, I got unable to upgrade to tcp, received 409 and now I stuck, because I can not even log into my machine, it's restarting all the time. I tried to change port to more custom, but it's also dead.

I used latest version, but I have changed it to ulm0/gitlab:12.10.0 and it works. Sounds like a bug in a new version.

Related

Can't acces apache on docker from my network

I have this Dockerfile :
FROM ubuntu:20.04
EXPOSE 80
After installing apache2 package in the container I can't acces the default page of apache from the network. Also docker is in a virtual machine with debian 10. If I try the official apache image (https://hub.docker.com/_/httpd) everything works fine but I want to know why installing it manually doesn't work.
To build the container from the image I use this command :
sudo docker run --name ubuntu -p 80:80 -it ubuntu /bin/bash
I have run the exactly same test on my virtual centos machine and found working.
I've build the image using your dockerfile and run apache installation using below command.
docker build -t ubuntu
docker run --name ubuntu -p 80:80 -it ubuntu /bin/bash
and In terminal opened by the above mentioned command, i ran the below command.
apt-get update
apt-get install apache2
service apache2 start
After that opened another ssh terminal keeping the current running as i have not run the Ubuntu container in detached mode and checked by using.
docker ps -a
and found container is running with exposing 0.0.0.0:80 and checked
curl localhost
Please make sure you have not stoped docker container before running curl command or hit in the browser as its not run in detached mode or background.

How to run docker command in docker container for appveyor server docker builds?

I'm setting up a new appveyor server and trying to build docker images with using the docker build feature. But when I try to run docker commands in my custom build container, got the error that shown below.
Cannot connect to the Docker daemon at unix:///var/run/docker.sock. Is the docker daemon running?
I think the appveyor server should run our custom build containers with the volume option that point the docker.sock.
sudo docker run --rm -it -v /var/run/docker.sock:/var/run/docker.sock -v /usr/bin/docker:/usr/bin/docker name-of-the-custom-image bash
You can modify Docker cloud settings under Account -> Build environment and put the following into Custom Docker command arguments:
-v /var/run/docker.sock:/var/run/docker.sock -v /usr/bin/docker:/usr/bin/docker
https://help.appveyor.com/discussions/problems/24364-how-to-run-docker-command-in-docker-container-for-appveyor-server-docker-builds

Teamcity Build won't run until Build Agents is configured with Docker?

I created a new build for my Teamcity pipeline. For the first time I use then Docker buildstep. After I setup everything I realized the build agent does not seem to be ready for it.
I understand that my agent does not seem to be ready for building with docker but nobody is actually telling me how you can do that. I read the official guides but no word about how to actually install docker into my agent (if that's the way to solve the problem).
Can someone tell me what I have to do to get it to work?
EDIT
#Senior Pomidor helped me to get one step closer. I added his first example to the docker run command
docker run -it -e SERVER_URL="<url to TeamCity server>" \
--privileged -e DOCKER_IN_DOCKER=start \
jetbrains/teamcity-agent
After doing so I got rid of the mentioned messages in the screenshot. My Agents configuration now has the following:
docker.server.osType linux
docker.server.version 18.06.1
docker.version 18.06.1
But still Teamcity is complaining with this message:
Which kinda leaves me clueless again.
Final Solution:
The upcoming EDIT2 issue could be resolved by just restarting the teamcity server instance. The agent was actually able to run the build but teamcity was not able to realise that without a reboot.
EDIT2
Request Information:
My CI Server OS:
PRETTY_NAME="Debian GNU/Linux 9 (stretch)"
NAME="Debian GNU/Linux"
VERSION_ID="9"
VERSION="9 (stretch)"
Running Container:
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
0f8e0b04d6a6 jetbrains/teamcity-agent "/run-services.sh" 19 hours ago Up 19 hours 9090/tcp teamcity-agent
20964c22b2d9 jetbrains/teamcity-server "/run-services.sh" 37 hours ago Up 37 hours 0.0.0.0:80->8111/tcp teamcity-server-instance
Container run by:
## Server
docker run -dit --name teamcity-server-instance -v /data/teamcity:/data/teamcity_server/datadir -v /var/log/teamcity:/opt/teamcity/logs -p 80:8111 jetbrains/teamcity-server
## Agent
docker run -itd --name teamcity-agent -e SERVER_URL="XXX.XXX.XXX.XXX:80" --privileged -e DOCKER_IN_DOCKER=start -v /etc/teamcity/agent/conf:/data/teamcity_agent/conf jetbrains/teamcity-agent
Build Step Information:
TC restricted the configuration because of TA doesn't start Docker daemon.
You should pass -e DOCKER_IN_DOCKER=start for automatically staring the docker daemon in the container. Also, docker daemon needs the docker socket. In a Linux container, if you need a Docker daemon available inside your builds, you have two options:
--privileged flag. New Docker daemon running within your container
-v docker_volumes:/var/lib/docker Docker from the host (in this case you will benefit from the caches shared between the host and all your containers but there is a security concern: your build may actually harm your host Docker, so use it at your own risk)
In a Linux container, if you need a Docker daemon available inside your builds, you have two options:
Docker from the host (in this case you will benefit from the caches shared between the host and all your containers but there is a security concern: your build may actually harm your host Docker, so use it at your own risk)
examples
docker run -it -e SERVER_URL="<url to TeamCity server>" \
--privileged -e DOCKER_IN_DOCKER=start \
jetbrains/teamcity-agent
docker run -it -e SERVER_URL="<url to TeamCity server>" \
-v /var/run/docker.sock:/var/run/docker.sock \
jetbrains/teamcity-agent
UPD
docker.server.osType required because in the build step was sets linux
What worked for me was changing permissions on the agent container for /var/run/docker.sock
Run a shell inside the container:
docker exec -u 0 -it <CONTAINER_ID> bash
Change permissions of the docker socket:
chmod 666 /var/run/docker.sock
Verify the docker container use the socket:
docker version

jenkins in docker - Cannot connect to the Docker daemon at unix:///var/run/docker.sock. Is the docker daemon running?

I'm running https://hub.docker.com/r/jenkinsci/blueocean/ in docker. Trying to build a docker image in jenkins.
but i get the following error:
Cannot connect to the Docker daemon at unix:///var/run/docker.sock. Is the docker daemon running?
clearly the jenkins version in docker does not have access to the docker binary.
I confirmed this by,
docker exec -it db4292380977 bash
docker images
Cannot connect to the Docker daemon at unix:///var/run/docker.sock. Is the docker daemon running?
"db4292380977" is the running container. It shows the same error.
Question:
how do I allow access to docker in the jenkins container?
The docker client is installed on the jenkinsci/blueocean image, but not the daemon. Docker client will use the daemon (by default via the socket unix:///var/run/docker.sock). Docker client needs a Docker daemon in order to work, you can read Docker Architecture for more info.
What you can do:
Use docker-in-docker (DinD) image
Library Docker image provides a way to run a Docker daemon in Docker, you can then use it from another container. For example, using plain docker CLI:
docker run --name docker-dind --privileged -d docker:stable-dind
docker run --name jenkins --link=docker-dind -d jenkinsci/blueocean
docker exec jenkins docker -H docker-dind images
REPOSITORY TAG IMAGE ID CREATED SIZE
Docker daemon runs in docker-dind container and can be reached using the same hostname. You just need to provide the docker client with the daemon host (-H docker-dind in the example, you can also use DOCKER_HOST env variable as described in the doc).
Mount host machine /var/run/docker.sock in your container
As described by #Herman Garcia answer:
docker run -p 8080:8080 --user root \
-v /var/run/docker.sock:/var/run/docker.sock jenkinsci/blueocean
You need to mount your local /var/run/docker.sock and run the container as root user
NOTE: this might be a security flaw so be careful who has access to the jenkins container
docker run -p 8080:8080 --user root \
-v /var/run/docker.sock:/var/run/docker.sock jenkinsci/blueocean
you will be able to execute docker inside the container
➜ ~ docker exec -it gracious_agnesi bash
bash-4.4# docker ps
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS
NAMES
c4dc85b0d88c jenkinsci/blueocean "/sbin/tini -- /usr/…" 18 seconds ago Up 16 seconds 0.0.0.0:8080->8080/tcp, 50000
/tcp gracious_agnesi
Just only try to do the same command but with sudo in the beginning
For example
sudo docker images
sudo docker exec -it db4292380977 bash
To avoid use sudo in the future you should run this command in Unix O.S
sudo usermod -aG docker <your-user>
Change for the user that you are using at this moment. Remember to log out and back in for this to take effect! More information about Docker installation click here

Install CI gitlab with Docker in Windows

Trying to install a gitlab runner on my windows machine inside a docker container
Using
docker run -d --name gitlab-runner --restart always \ -v ${PWD}/gitla
/gitlab-runner \ -v /var/run/docker.sock:/var/run/docker.sock \ gitlab/gitlab-runner:latest
I'm following the official docs but nothing refers to windows
https://docs.gitlab.com/runner/install/docker.html
What's the correct way to set-up a docker container to execute a gitlab runner?
Thanks in advance!
It currently isn't fully supported, however there is an open issue and relevant open merge request to add that functionality!

Resources