Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

You have to remove (or rename) that container to be able to reuse that name. #62

Open
vinay-appup opened this issue Apr 15, 2019 · 1 comment
Labels

Comments

@vinay-appup
Copy link

vinay-appup commented Apr 15, 2019

{ Error: (HTTP code 409) unexpected - Conflict. The container name "/test" is already in use by container "70f415ef635ece943bee6c935f78b0912a88573e95ab8f7fe9d24d397e5e8379". You have to remove (or rename) that container to be able to reuse that name.

It is taking some time to delete the container(1000 ms). How to resolve this.

docker.container.list()
                   .then(containers => containers.forEach(function(value, i) {
                       if (value.data.Names.includes('/test')) {
                           value.delete({force: true})
                       }
                   })).then( docker.container.create({
                               Image: '**',
                               name: 'test',
                               Env: [  ],
                               "HostConfig": {
                                   "NetworkMode": "host"
                               }
                           })
                           .then(container => container.start())
                           .catch(error => console.log(error)));
@AgustinCB AgustinCB added the bug label Nov 16, 2020
@AgustinCB
Copy link
Owner

Hah! Thank you so much! I will fix existing code to take this into account.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants