Get pypy mini server docker image
https://hub.docker.com/r/pypiserver/pypiserver
docker pull pypiserver/pypiserver
Create a new project
Install library pypiserver
pip install pypiserver
Create a new folder containing the packages to share
mkdir ~/packages
Add package tar.gz in packages # Will listen to all IPs.
& is to put the task in a background process
# for linux and mac
pypi-server run -p 8080 ./packages &
# to kill process, look to pid and kill task based on pid
ps | grep pypi
kill <pid>
# windows, linux and mac
pypi-server run -d -p 8080 ./packages

pip install --index-url http://localhost:8080/simple/ trading_sdk
# uninstall
pip uninstall -y trading_sdk
Expose pypi server on the local network
Using host IP:
i) Run the command
docker run -d \
--name pypiserver \
-p 8080:8080 \
-v ~/packages:/packages pypiserver/pypiserver
# host ip not working yet
docker run -d \
--name pypiserver \
-p 8080:80 \
--network host \
-v ~/packages:/packages pypiserver/pypiserver
--network host
: This tells Docker to use the host’s network interface directly, so the container can use the host’s IP.-p 8080:80
: This maps the port inside the container (port 80) to the host’s port (port 8080).
By using --network host
, you don’t need to bind to a specific IP address because the container directly uses the host’s network.
ii) Access the container
Now, on another device in your local network, you can access the container using the host machine’s local IP (the one that is part of the local network)http://192.168.x.x:8080
Replace 192.168.x.x
with your host machine’s IP address.
http://192.168.x.x:8080
Note:
- Platform-specific:
--network host
works on Linux but may not work as expected on Windows or macOS (they have different network modes).
Using a custom IP:
docker network create --driver=bridge --subnet=192.168.1.0/24 my_custom_network # network config using router as bridge
docker run -d --net my_custom_network --ip 192.168.1.200 -p 8080:80 my-container
docker run -d \
--name pypiserver \
-p 8080:8080 \
-v ~/packages:/packages \
pypiserver/pypiserver
Expose pypi server on the public network
Create account on ngrok
Verify your account and generate a ngrok token
ngrok http 8080

Early in my career, I specialized in the Python language. Python has been a constant in my professional life for over 10 years now. In 2018, I moved to London where I worked at companies of various sizes as a Python developer for five years. In parallel, I developed my activity as a Mentor, to which I now dedicate myself full-time.