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

Docker run argument --name not working #61

Closed
sandrokeil opened this issue Jul 15, 2018 · 3 comments · Fixed by #66
Closed

Docker run argument --name not working #61

sandrokeil opened this issue Jul 15, 2018 · 3 comments · Fixed by #66

Comments

@sandrokeil
Copy link
Contributor

It would be great if I can set the name of the Docker container. If I try x11docker -- --name=cathode jess/cathode it fails with Error response from daemon: no such image: x11docker_X100_3c3ea8_jess-cathode: invalid reference format: repository name must be lowercase. I'm not sure if it is because of the duplicate --name argument in the docker run command.

Adding an optional x11docker argument --name would be useful to set an own Docker container name to identify this container in a network via the name. I need this for debugging. I have an IDE Docker Container and a Docker Compose network. I join the IDE Docker Container to the Docker Compose network but I have to set the debug host IP/Name (the IDE Docker Container in this case) manually.

What do you think or are there any problems with setting a custom container name?

@mviereck
Copy link
Owner

Your setup failed because x11docker checks for successfull startup using the container name and believes that the startup failed.

One possibility is to use option --showid that gives the container ID on stdout. This ID is equivalent to the container name:

read ID < <(x11docker --showid image)

An option --name for a custom container name is reasonable. One issue: Option --cleanup checks for containers that did not terminate successfully and removes them. The check relies on x11docker_X as part of container name.

Would --showid be ok, or would you prefer a meaningful name instead of an anonymous number? Be aware that a custom --name will fail if a container with same name is already in docker ps -a, e.g. due to a failed stop. The ID will always be unique and won't fail.

@sandrokeil
Copy link
Contributor Author

The Docker container id will work too. The problem is, that the container ID will change on every startup so I have to update my debug config every time.

I can live with the drawbacks of using a custom container name. It's only a special use case but I think it can be useful for others too.

Time for a new PR? ;-)

@mviereck
Copy link
Owner

Time for a new PR? ;-)

yeah :-)

To reduce the issue with --cleanup you could create a file container.name that is checked in cleanup() additonally to current check of x11docker_X in docker ps -a.

sandrokeil added a commit to sandrokeil/x11docker that referenced this issue Jul 17, 2018
sandrokeil added a commit to sandrokeil/x11docker that referenced this issue Jul 18, 2018
mviereck added a commit that referenced this issue Jul 18, 2018
--name: Add support for own Docker container name (close #61)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants