0

I'm trying to a gitlab/gitlab-ce image up and running with docker-compose on macOS (Big Sur) (docker-compose up -d). I'm using docker-machine with the virtualBox driver.

However, when starting the container I get the following error:


ERROR: for web  Cannot start service web: driver failed programming external connectivity on endpoint gitlab-docker_web_1 (236233cf090b94f98e2e82c2fa795bc7f6f5ff38e2ea14f3649e87313a21d196): Error starting userland proxy: listen tcp 0.0.0.0:22: bind: address already in use
ERROR: Encountered errors while bringing up the project.

The issues is, I can't find anything running on port 22 on the host.

> sudo lsof -i :22
>

returns nothing. Running netstat -l | grep 22 to look for listening ports I don't see anything either:

tcp4       0      0  byrons-mac-pro.l.61179 229.26.211.130.b.https ESTABLISHED
tcp4       0      0  byrons-mac-pro.l.60764 108.177.122.108.imaps  ESTABLISHED
tcp4       0      0  byrons-mac-pro.l.60761 108.177.122.108.imaps  ESTABLISHED
tcp4       0      0  byrons-mac-pro.l.60760 108.177.122.108.imaps  ESTABLISHED
tcp4       0      0  byrons-mac-pro.l.60759 108.177.122.108.imaps  ESTABLISHED
tcp4       0      0  byrons-mac-pro.l.60758 108.177.122.108.imaps  ESTABLISHED
tcp4       0      0  byrons-mac-pro.l.60755 108.177.122.108.imaps  ESTABLISHED
tcp4       0      0  byrons-mac-pro.l.60754 108.177.122.108.imaps  ESTABLISHED
tcp4       0      0  byrons-mac-pro.l.54147 yi-in-f188.1e100.5228  ESTABLISHED
tcp4       0      0  byrons-mac-pro.l.49743 104.22.52.136.https    ESTABLISHED
tcp4       0      0  byrons-mac-pro.l.49734 yv-in-f188.1e100.5228  ESTABLISHED
tcp4       0      0  byrons-mac-pro.l.49556 108.177.122.95.https   ESTABLISHED
tcp4       0      0  byrons-mac-pro.l.49173 17.57.144.150.5223     ESTABLISHED
tcp4       0      0  byrons-mac-pro.l.61183 52.96.122.50.https     TIME_WAIT
tcp4       0      0  byrons-mac-pro.l.61182 52.96.122.50.https     TIME_WAIT
udp4       0      0  byrons-mac-pro.l.56826 108.177.122.139.https
c0fd8701c6b3232b stream      0      0                0 c0fd8701c6b32263                0                0
c0fd8701c6b32263 stream      0      0                0 c0fd8701c6b3232b                0                0
c0fd8701b7e36583 stream      0      0 c0fd8701b9bb407b                0                0                0 /var/folders/yt/c5z_l8554mq_fc3f0c5tpw600000gn/T/dotnet-diagnostic-2202-1621045110-socket
c0fd8701add5cb63 stream      0      0                0 c0fd8701add5ca9b                0                0 /var/folders/yt/c5z_l8554mq_fc3f0c5tpw600000gn/T/vscode-ipc-a70bbba5-ec65-4f40-861a-0bc122628a75.sock
c0fd8701a9b0232b dgram       0      0                0 c0fd8701a9b02263 c0fd8701a9b02263                0
c0fd8701a9b02263 dgram       0      0                0 c0fd8701a9b0232b c0fd8701a9b0232b                0

I'm a bit stumped. Here's my docker-compose.yml:

web:
  image: "gitlab/gitlab-ce:latest"
  restart: always
  hostname: "byrons-mac-pro.lan"
  environment:
    GITLAB_OMNIBUS_CONFIG: |
      external_url 'http://byrons-mac-pro.lan'
      gitlab_rails['smtp_enable'] = true
      gitlab_rails['smtp_address'] = 'smtp.gmail.com'
      gitlab_rails['smtp_port'] = 587
      gitlab_rails['smtp_user_name'] = 'remove@cantellyou.com'
      gitlab_rails['smtp_password'] = '.........................'
      gitlab_rails['smtp_domain'] = 'smtp.gmail.com'
      gitlab_rails['smtp_authentication'] = 'login'
      gitlab_rails['smtp_enable_starttls_auto'] = true
      gitlab_rails['smtp_tls'] = false
      gitlab_rails['smtp_openssl_verify_mode'] = 'peer' # Can be: 'none', 'peer', 'client_once', 'fail_if_no_peer_cert', see http://api.rubyonrails.org/classes/ActionMailer/Base.html
      puma['worker_processes'] = 2
      sidekiq['max_concurrency'] = 10
      prometheus_monitoring['enable'] = false
  ports:
    - "80:80"
    - "443:443"
    - "22:22"
  volumes:
    - "$GITLAB_HOME/config:/etc/gitlab"
    - "$GITLAB_HOME/logs:/var/log/gitlab"
    - "$GITLAB_HOME/data:/var/opt/gitlab"
0

It is a quirk of the fact that macOS does not have native docker, and thus all(?) implementations have a backing virtual machine in which the Linux kernel and dockerd are running (something that I would have thought was obvious from the docker-machine you are currently aware of, but ... I guess not). It is almost certainly that machine which is listening on 22, given that most folks actually do want access to that virtual machine for troubleshooting

I have better than average confidence that you can customize the virtual machine which docker-machine starts and ask it to bind ssh to :2222 (akin to this), or "cheat" and docker-machine ssh systemctl stop sshd.service type thing, freeing up the ssh port but from that point forward docker-machine ssh and maybe even docker-machine stop might not work as you expect

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.