Equivqlent of docker run --expose {port} in docker-py
See original GitHub issueHi
I’ve been trying to expose ports with this library as you would with docker create --expose 80
but have been unable to. I can’t seem to find anything in the documentation on how to do this.
Any help would be appreciated.
OS: Ubuntu 18.04
~$ pip3 freeze | grep docker && python3 --version && docker version
docker==3.6.0
docker-pycreds==0.4.0
Python 3.6.7
Client:
Version: 18.09.0
API version: 1.39
Go version: go1.10.4
Git commit: 4d60db4
Built: Wed Nov 7 00:49:01 2018
OS/Arch: linux/amd64
Experimental: false
Server: Docker Engine - Community
Engine:
Version: 18.09.0
API version: 1.39 (minimum version 1.12)
Go version: go1.10.4
Git commit: 4d60db4
Built: Wed Nov 7 00:16:44 2018
OS/Arch: linux/amd64
Experimental: false
Issue Analytics
- State:
- Created 5 years ago
- Reactions:1
- Comments:6
Top Results From Across the Web
Port Bindings - docker-py Documentation
Port bindings is done in two parts. Firstly, by providing a list of ports to open inside the container in the Client().create_container() method....
Read more >Run your image as a container
Let's start our image and make sure it is running correctly. Run the following command in your terminal. $ docker run python-docker.
Read more >python - What is the equivalent command for docker port ...
I trying to automate a docker server using docker-py. Need to check whether the host URL is pinging or not using python. Hence...
Read more >docker-py
Client(base_url='unix://var/run/docker.sock', version='1.9', timeout=10). base_url refers to the protocol+hostname+port where the docker server is hosted.
Read more >Running Python on Docker - Earthly Blog
The container image can be pushed and retrieved from the Docker Hub registry. Docker Hub is an open source library and community for...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Try this:
Hello,
I think there’s a subtlety being missed. If I use docker-py to start a container with
I can see with
docker inspect
that it comes across asHowever, if I run the container directly with
--expose 8080
,docker inspect
showsAdditionally, I’m unable to hit the container’s ip address on port 8080 with docker-py’s setup, but I am able to hit it with the container that used
--expose 8080
.I could be missing some critical piece of docker know-how, here, so any help/advice is greatly appreciated. Thanks!