I am trying to run two docker containers from same docker-compose file. I am trying to create gitlab community and enterprise version from docker-compose files. If I run only one container at a time I am able to create Gitlab Community/Enterprise version. I have created different mounting volumes for both containers. However, when I try to run both the containers from same docker-compose file , the status of both the containers become unhealthy. Is ther any way to deploy gitlab community and enterprise versions from same docker-compose files?
Hi @aditi-gitlab, and welcome to the GitLab Community Forum!
Good question!
I suspect the reason you’re unable to run both CE and EE alongside one another with the same docker compose file is that both containers are using the same ports, but each port is only equipped to handle one input. For example, nginx
runs on port 80/443 for both CE and EE, and ssh
runs on port 22
. If CE container is using port 22/80/443, then these ports are occupied and can’t be re-assigned or co-assigned to the EE container.
A temporary fix would be to set up both containers to use different ports for their services. CE could use 22/80/443 for SSH/HTTP/HTTPS, and EE could use 2222/800/4430. This will require editing docker-compose and GitLab configuration files.
For best performance and production use, I suggest running one GitLab container or instance per server. This ensures there the hardware requirements are consistently met without two GitLab instances/containers competing for resources.
Thank You for your reply.
I have mapped different ports for gitlab CE and gitlab EE.This is my docker-compose file:
version: ‘3.8’
services:
web1:
image: ‘gitlab/gitlab-ee:latest’
restart: always
hostname: ‘gitlab.test0.com’
environment:
GITLAB_OMNIBUS_CONFIG: |
external_url ‘https://gitlab.test0.com’
# Add any other gitlab.rb configuration here, each on its own line
ports:
- ‘81:80’
- ‘442:443’
- ‘23:22’
volumes:
- ‘/Users/asingh/gitlab/config:/etc/gitlab’
- ‘/Users/asingh/gitlab/logs:/var/log/gitlab’
- ‘/Users/asingh/gitlab/data:/var/opt/gitlab’
web2:
image: ‘gitlab/gitlab-ce:latest’
restart: always
hostname: ‘gitlab.test1.com’
environment:
GITLAB_OMNIBUS_CONFIG: |
external_url ‘https://gitlab.test1.com’
# Add any other gitlab.rb configuration here, each on its own line
ports:
- ‘83:80’
- ‘446:443’
- ‘26:22’
volumes:
- ‘/Users/asingh/gitlab_New/config:/etc/gitlab’
- ‘/Users/asingh/gitlab_New/logs:/var/log/gitlab’
- ‘/Users/asingh/gitlab_New/data:/var/opt/gitlab’
I have also mounted different storage volumes. I am able to run one container/instance per server. I was just curious if I am mapping different ports then it should work? Also could you elaborate on what should I edit in Gitlab configuration file?
@aditi-gitlab the official documentation source of truth on how to install GitLab using docker compose is:
https://docs.gitlab.com/omnibus/docker/#install-gitlab-using-docker-compose
Looking at your docker compose files, I can see that you’re specifying https://
URLs, but on your local system you probably want to use the IP address for your GitLab external_urls. Specifying HTTPS will automatically attempt to generate a letsencrypt certificate for your FQDN. If letsencrypt can’t resolve the domain name (usually requires DNS A record pointing to GitLab) at the time you start either GitLab container, https will fail to automatically be set-up and you won’t actually be able to use GitLab. With the docker-compose file as-is, I’d expect that even if only one container were run at a time that it would not result in a working GitLab instance.
Can you stop/remove any existing GitLab images, and deploy a new GitLab docker container with docker compose carefully following the instructions here: https://docs.gitlab.com/omnibus/docker/#install-gitlab-using-docker-compose
After doing that, can you confirm that navigating to the URL you defined for external_url
resolves to a "reset root password/login page?
GitLab EE is literally GitLab CE with an additional directory containing optional paid features that can be unlocked via free trial or license. There is no benefit to running CE alongside EE but there are a lot of problems that can arise from running both on the same machine. Can you help me understand the use case for running CE and EE side-by-side on the same machine?
‘With the docker-compose file as-is, I’d expect that even if only one container were run at a time that it would not result in a working GitLab instance.’ Yes it results in a working Gitlab instance. When I remove either of the containers-gitlab ce or ee, another one works. It launches a gitlab instance on -https://localhost:446
https://docs.gitlab.com/omnibus/docker/#install-gitlab-using-docker-compose- I followed the same link and it is using the external url on https.
After doing that, can you confirm that navigating to the URL you defined for external_url
resolves to a "reset root password/login page? - Yes it opens a gitlab page to reset password and then I am able to login with 'root ’ username and the newly entered password.
There is no benefit to running CE alongside EE but there are a lot of problems that can arise from running both on the same machine.- Could you elaborate on that please?
The company I work for wants me to write a script for automatic deployment of both community and enterprise versions.[quote=“gitlab-greg, post:4, topic:41773, full:true”]
@aditi-gitlab the official documentation source of truth on how to install GitLab using docker compose is:
https://docs.gitlab.com/omnibus/docker/#install-gitlab-using-docker-compose
Looking at your docker compose files, I can see that you’re specifying https://
URLs, but on your local system you probably want to use the IP address for your GitLab external_urls. Specifying HTTPS will automatically attempt to generate a letsencrypt certificate for your FQDN. If letsencrypt can’t resolve the domain name (usually requires DNS A record pointing to GitLab) at the time you start either GitLab container, https will fail to automatically be set-up and you won’t actually be able to use GitLab. With the docker-compose file as-is, I’d expect that even if only one container were run at a time that it would not result in a working GitLab instance.
Can you stop/remove any existing GitLab images, and deploy a new GitLab docker container with docker compose carefully following the instructions here: https://docs.gitlab.com/omnibus/docker/#install-gitlab-using-docker-compose
After doing that, can you confirm that navigating to the URL you defined for external_url
resolves to a "reset root password/login page?
GitLab EE is literally GitLab CE with an additional directory containing optional paid features that can be unlocked via free trial or license. There is no benefit to running CE alongside EE but there are a lot of problems that can arise from running both on the same machine. Can you help me understand the use case for running CE and EE side-by-side on the same machine?
[/quote]
This is the status of two containers. One of the container is healthy wile other one is unhealthy.