Skip to content
This repository has been archived by the owner on Apr 21, 2022. It is now read-only.

Ability to resolve naming conflicts in docker-compose #18

Open
blackandred opened this issue Jul 11, 2020 · 0 comments
Open

Ability to resolve naming conflicts in docker-compose #18

blackandred opened this issue Jul 11, 2020 · 0 comments
Labels
enhancement New feature or request
Milestone

Comments

@blackandred
Copy link
Contributor

blackandred commented Jul 11, 2020

Correctly handle case, when docker-compose says it cannot create containers because the name is already used - at least what we can do is retry the operation which usually works.

   ===> Starting "gateway_letsencrypt" (1 instances)...
[2020-07-11 08:27:34.483][info]: Doing a "rolling" deployment for "gateway_letsencrypt"
[2020-07-11 08:27:34.484][info]: Processing instance #1/1
[2020-07-11 08:27:34.484][info]: Suspending service discovery
[2020-07-11 08:27:34.971][info]: Scaling up to 2
Creating anarchist_project_gateway_letsencrypt_1 ... 
Creating anarchist_project_gateway_letsencrypt_2 ... 
Creating anarchist_project_gateway_proxy_gen_1
Creating anarchist_project_gateway_letsencrypt_1 ... done
Creating anarchist_project_gateway_letsencrypt_1

ERROR: for anarchist_project_gateway_letsencrypt_2  Cannot create container for service gateway_proxy_gen: Conflict. The container name "/anarchist_project_gateway_proxy_gen_1" is already in use by container "c6b73cdcb025091d31db78df79010819388bacf220bb42f9502da1393fc953fa". You have to remove (or rename) that container to be able to reuse that name.

ERROR: for gateway_letsencrypt  Cannot create container for service gateway_proxy_gen: Conflict. The container name "/anarchist_project_gateway_proxy_gen_1" is already in use by container "c6b73cdcb025091d31db78df79010819388bacf220bb42f9502da1393fc953fa". You have to remove (or rename) that container to be able to reuse that name.
Encountered errors while bringing up the project.
[2020-07-11 08:27:37.405][error]: Scaling back to declared state as error happened: Command 'bash' returned non-zero exit status 1.
anarchist_project_gateway_letsencrypt_1 is up-to-date
[2020-07-11 08:27:37.960][info]: Starting service discovery
Starting anarchist_project_gateway_1 ... done
Starting anarchist_project_gateway_proxy_gen_1 ... 
Starting anarchist_project_gateway_proxy_gen_1 ... done
Traceback (most recent call last):
  File "/project/.venv/lib/python3.6/site-packages/rkd/executor.py", line 65, in execute
    env=declaration.get_env()
  File "/project/.venv/lib/python3.6/site-packages/harbor/tasks/base.py", line 136, in execute
    return self.run(context)
  File "/project/.venv/lib/python3.6/site-packages/harbor/tasks/service.py", line 101, in run
    return strategies[strategy]()
  File "/project/.venv/lib/python3.6/site-packages/harbor/tasks/service.py", line 87, in <lambda>
    'rolling': lambda: self.deploy_rolling(service, context),
  File "/project/.venv/lib/python3.6/site-packages/harbor/tasks/service.py", line 170, in deploy_rolling
    raise e
  File "/project/.venv/lib/python3.6/site-packages/harbor/tasks/service.py", line 151, in deploy_rolling
    existing_containers = self.containers(ctx).scale_one_up(service)
  File "/project/.venv/lib/python3.6/site-packages/harbor/driver.py", line 372, in scale_one_up
    raise e
  File "/project/.venv/lib/python3.6/site-packages/harbor/driver.py", line 368, in scale_one_up
    capture=True
  File "/project/.venv/lib/python3.6/site-packages/harbor/driver.py", line 194, in compose
    return self.scope.sh(cmd, capture=capture)
  File "/project/.venv/lib/python3.6/site-packages/rkd/contract.py", line 282, in sh
    cmd=cmd, capture=capture, verbose=verbose, strict=strict, env=env
  File "/project/.venv/lib/python3.6/site-packages/rkd/taskutil.py", line 92, in sh
    return check_output('bash', shell=True, stdin=read).decode('utf-8')
  File "/usr/lib/python3.6/subprocess.py", line 356, in check_output
    **kwargs).stdout
  File "/usr/lib/python3.6/subprocess.py", line 438, in run
    output=stdout, stderr=stderr)
subprocess.CalledProcessError: Command 'bash' returned non-zero exit status 1.
Command '#!/bin/bash -eopipefail 
set -euo pipefail; export PYTHONUNBUFFERED=1;  /project/.venv/bin/harbor --no-ui --no-ui :harbor:service:up gateway_letsencrypt  --strategy=auto' returned non-zero exit status 1.Cannot start service "gateway_letsencrypt"

Steps to reproduce:
Deploy to a fresh environment - do a docker prune on containers, networks and volumes.

@blackandred blackandred added the enhancement New feature or request label Jul 11, 2020
@blackandred blackandred added this to the Harbor 2.0 on RKD milestone Jul 11, 2020
blackandred added a commit that referenced this issue Jul 21, 2020
(.venv) [riotkit-ops Environment]$ sudo harbor :service:up --name dokuwiki --strategy rolling
Doing a "rolling" deployment for "dokuwiki"
Processing instance #1/1
Suspending service discovery
Stopping your_project_there_gateway_proxy_gen_1 ... done
Scaling up to 2
Finding last instance name...
OK, it is "your_project_there_dokuwiki_18"
Checking health of "dokuwiki" service - instance #18
Docker reports "starting" - performing a manual check, we wont wait for docker
Docker reports "starting" - performing a manual check, we wont wait for docker
Service healthy after 2s
Replica "your_project_there_dokuwiki_18" was spawned, killing older instance
Killing replica num=17
your_project_there_dokuwiki_17
Starting service discovery
Starting gateway_proxy_gen ... done
@blackandred blackandred modified the milestones: Harbor 2.1, Harbor 2.3 Nov 11, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant