-
Notifications
You must be signed in to change notification settings - Fork 18.6k
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
Override named container with -oc or --override-container parameter #22811
Comments
You can already do so using
|
I think this is a duplicate of #2733, so I'll close this issue, but feel free to comment here after I closed 👍 |
That's interesting, because --rm is also a hack that exists only in the client. Your solution is quite sophisticated especially, when you are just trying things :( |
maybe this could help you : create imagedocker build -t my_image . run image as container (remove before run)docker rm "my_awesome_containter" -f && docker run --name "my_awesome_containter" my_image more elegantcontainer_name="my_awesome_containter" first call fails because container does not exist (coming soon) |
Named containers are cool, but you should provide --rm to make your run command repeatable, but deleting containers after stopping is not always the desired behavior because we want inspect them or tail their log, etc. During the development would be nice to use named containers and make possible their overriding with a parameter.
Suggested parameteres:
-oc or --override-container - Overriding the same named container if exists
-f or --force - Force the override of the named container
Current situation:
Step 1:
docker run --name ubuntu ubuntu echo hello
Step 2: repeating step 1 is not possible without --rm.
Suggested way:
Step 1:
docker run --name ubuntu ubuntu echo hello
Step 2:
docker run -oc --name ubuntu ubuntu echo hello
In step 2 the docker client calls an rm first on the image.
Optional parameter: -f or --force for forced replacement
Step 2:
docker run -f -oc --name ubuntu ubuntu echo hello
The text was updated successfully, but these errors were encountered: