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

No way to set --ip flag on docker-run tasks #2259

Closed
ForceConstant opened this issue Aug 27, 2020 · 7 comments · Fixed by #2294
Closed

No way to set --ip flag on docker-run tasks #2259

ForceConstant opened this issue Aug 27, 2020 · 7 comments · Fixed by #2294

Comments

@ForceConstant
Copy link

I want to use the docker-run task type to start a container, but would also like to set the ip address? How can I do this, I don't see anything in the reference.
Thanks.

@PavelSosin-320
Copy link

What do you mean by saying Container IP? On which network? Please, read about Docker networking. You can find detailed explanation there. This is not 5 min reading but absolutely necessary.

@ForceConstant
Copy link
Author

@PavelSosin-320 This is how I would do something like this on the command line: docker run --rm --net my_container_net --ip 10.120.100.2 -it -p 22:22/tcp my_container:latest Static IP, and not just hostname is necessary due to the applications that are being run.

@bwateratmsft
Copy link
Collaborator

The --ip flag does not exist currently on the docker-run task. We can consider adding it.

@bwateratmsft bwateratmsft changed the title How to set ip address of container? Where is '--ip' command? No way to set --ip flag on docker-run tasks Aug 27, 2020
@PavelSosin-320
Copy link

Static IP exists in a single scenario: standalone container running on a standalone node. The real IP can be derived from docker node inspect. Docker endpoint can be provided in many ways: Standalone docker, Cloud Instance. Swarm, Docker stack deployed to Kubernetes. It will be very disappointing to get such a limitation - single scenario compatibility: Docker-provided-by-Docker-desktop-without-Kubernetes-installed-withuot-Swarm activated.
If somebody needs static IP the option of network type=host and Host with static IP or localhost doesn't require any development.

@PavelSosin-320
Copy link

P.S. static IP of the Docker container is impossible because Docker engine governs containers' lifetime and replication. It can't ask "Say me which IP to assign?" every time when it instantiates, restarts, attaches to a network, replicates containers. docker run has nothing common with run application.

@PavelSosin-320
Copy link

@bwateratmsft Taking into account that the default of docker network create is attachable = true today the static coupling between network and port in one parameter will be extremely inconvenient because it produces a huge number of combinations. It also eliminates using of -P (in capital).
Docker networking is one of the best-designed concepts in Application development and hardly requires improvement.

@bwateratmsft
Copy link
Collaborator

This is now fixed in Docker extension version 1.7.0.

@vscodebot vscodebot bot locked and limited conversation to collaborators Oct 26, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants