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

handle already in use container name #6906

Merged
merged 6 commits into from
Mar 6, 2020

Conversation

medyagh
Copy link
Member

@medyagh medyagh commented Mar 6, 2020

closes #6899
closes #6713

before this PR:

if you delete machine folder and profile folder and kill the minikube container

medya@~/workspace/minikube (master) $ docker kill 8f47e4ec187d
medya@~/workspace/minikube (master) $ rm -rf ~/.minikube/profiles/minikube/
medya@~/workspace/minikube (master) $ ./out/minikube start --vm-driver=docker

and then start minikube you would get this error

😄  minikube v1.7.3 on Darwin 10.14.6
✨  Using the docker driver based on user configuration
🔥  Creating Kubernetes in docker container with (CPUs=2) (8 available), Memory=4096MB (7963MB available) ...

💣  Unable to start VM. Please investigate and run 'minikube delete' if possible: creating host: create: creating: create kic node: create a kic node: args: [run -d -t --privileged --security-opt seccomp=unconfined --tmpfs /tmp --tmpfs /run -v /lib/modules:/lib/modules:ro --hostname minikube --name minikube --label created_by.minikube.sigs.k8s.io=true --label name.minikube.sigs.k8s.io=minikube --label role.minikube.sigs.k8s.io= --label mode.minikube.sigs.k8s.io=minikube --volume minikube:/var --cpus=2 --memory=4096mb --expose 8443 --publish=127.0.0.1::8443 --publish=127.0.0.1::22 --publish=127.0.0.1::2376 gcr.io/k8s-minikube/kicbase:v0.0.7@sha256:a6f288de0e5863cdeab711fa6bafa38ee7d8d285ca14216ecf84fcfb07c7d176]  output: [docker: Error response from daemon: Conflict. The container name "/minikube" is already in use by container "8f47e4ec187d722bdc748714c29cd7e8ec35a4a4dee5d39c77db050c020eda3f". You have to remove (or rename) that container to be able to reuse that name. See 'docker run --help'.] : exit status 125

😿  minikube is exiting due to an error. If the above message is not useful, open an issue:

After this PR:

  • if we find already existing container with same name, we will check if was created by minikube (by inspecting the labels) if yes we will delete it and recreate it.
😄  minikube v1.7.3 on Darwin 10.13.6
✨  Using the docker driver based on user configuration
🔥  Creating Kubernetes in docker container with (CPUs=2) (2 available), Memory=4096MB (7964MB available) ...
🐳  Preparing Kubernetes v1.17.3 on Docker 19.03.2 ...
    ▪ kubeadm.pod-network-cidr=10.244.0.0/16
🚀  Launching Kubernetes ... 

in the logs you would be seeing

I0305 22:27:02.148397   13158 kic.go:103] Found already existing abandoned minikube container, will try to delete.
  • if container exists but was not created by minikube (a user's container) will exit with an error to tell user they need to delete the conflicting container name.

@k8s-ci-robot k8s-ci-robot added cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. size/M Denotes a PR that changes 30-99 lines, ignoring generated files. labels Mar 6, 2020
@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: medyagh

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@k8s-ci-robot k8s-ci-robot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Mar 6, 2020
@medyagh
Copy link
Member Author

medyagh commented Mar 6, 2020

/ok-to-test

@k8s-ci-robot k8s-ci-robot added the ok-to-test Indicates a non-member PR verified by an org member that is safe to test. label Mar 6, 2020
@medyagh medyagh changed the title fix already in use handle already in use Mar 6, 2020
@medyagh medyagh changed the title handle already in use handle already in use container name Mar 6, 2020
@minikube-pr-bot
Copy link

Error: running mkcmp: exit status 1

@medyagh medyagh requested a review from tstromberg March 6, 2020 06:54
pkg/drivers/kic/kic.go Outdated Show resolved Hide resolved
pkg/drivers/kic/kic.go Outdated Show resolved Hide resolved
pkg/drivers/kic/oci/oci.go Outdated Show resolved Hide resolved
pkg/drivers/kic/oci/oci.go Outdated Show resolved Hide resolved
@minikube-pr-bot
Copy link

All Times minikube: [ 95.870119 96.363653 100.102008]
All Times Minikube (PR 6906): [ 90.550223 98.128440 94.930481]

Average minikube: 97.445260
Average Minikube (PR 6906): 94.536381

Averages Time Per Log

+----------------------+-----------+--------------------+
|         LOG          | MINIKUBE  | MINIKUBE (PR 6906) |
+----------------------+-----------+--------------------+
| minikube v           |  0.204698 |           0.201560 |
| Creating kvm2        | 23.281449 |          23.325048 |
| Preparing Kubernetes | 49.543510 |          46.218888 |
| Pulling images       |           |                    |
| Launching Kubernetes | 21.530836 |          21.580263 |
| Waiting for cluster  |  0.051553 |           0.060166 |
+----------------------+-----------+--------------------+

@tstromberg tstromberg merged commit 9396c5c into kubernetes:master Mar 6, 2020
@medyagh medyagh deleted the already_in_use branch May 2, 2020 22:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved Indicates a PR has been approved by an approver from all required OWNERS files. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. ok-to-test Indicates a non-member PR verified by an org member that is safe to test. size/M Denotes a PR that changes 30-99 lines, ignoring generated files.
Projects
None yet
4 participants