{"id":28262883,"url":"https://github.com/jonasalfredsson/docker-devpi","last_synced_at":"2025-08-20T16:08:22.001Z","repository":{"id":40467935,"uuid":"466188156","full_name":"JonasAlfredsson/docker-devpi","owner":"JonasAlfredsson","description":"Docker images of the Devpi server and client program, which work as a local index and caching server for pip packages.","archived":false,"fork":false,"pushed_at":"2025-06-13T14:08:18.000Z","size":68,"stargazers_count":41,"open_issues_count":1,"forks_count":5,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-06-13T15:25:16.746Z","etag":null,"topics":["alpine","amd64","arm64","armv7","debian","devpi","devpi-client","devpi-server","docker","hacktoberfest","i386"],"latest_commit_sha":null,"homepage":"","language":"Shell","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/JonasAlfredsson.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2022-03-04T16:10:12.000Z","updated_at":"2025-06-13T14:08:15.000Z","dependencies_parsed_at":"2023-10-11T18:59:36.680Z","dependency_job_id":"6d65f533-9dcc-47ec-aa35-32933b5ab1e8","html_url":"https://github.com/JonasAlfredsson/docker-devpi","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/JonasAlfredsson/docker-devpi","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/JonasAlfredsson%2Fdocker-devpi","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/JonasAlfredsson%2Fdocker-devpi/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/JonasAlfredsson%2Fdocker-devpi/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/JonasAlfredsson%2Fdocker-devpi/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/JonasAlfredsson","download_url":"https://codeload.github.com/JonasAlfredsson/docker-devpi/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/JonasAlfredsson%2Fdocker-devpi/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":260175825,"owners_count":22970057,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["alpine","amd64","arm64","armv7","debian","devpi","devpi-client","devpi-server","docker","hacktoberfest","i386"],"created_at":"2025-05-20T07:13:09.715Z","updated_at":"2025-06-16T14:31:45.334Z","avatar_url":"https://github.com/JonasAlfredsson.png","language":"Shell","funding_links":[],"categories":[],"sub_categories":[],"readme":"# docker-devpi\n\nDocker images for both [`devpi-server`][1] and [`devpi-client`][2], with both\nDebian and Alpine versions available.\n\n[Devpi][3] allows you to host a local PyPi cache, along with the ability for you to\nadd your own packages that you do not want to upload publicly.\n\n\u003e :information_source: Docker tags use the same version numberings as the devpi\n\u003e packges on PyPi ([server][5] \u0026 [client][6]), but can be viewed on DockerHub\n\u003e as well: [server][7] \u0026 [client][8].\n\n\n# Usage\n\nThis repository is split into two parts: the [server](#server) and the\n[client](#client). You will of course need a working server before there is\nany point in using the client.\n\n## Server\n\n###  Environment Variables\n- `DEVPI_PASSWORD`: The password to set for the \"root\" user on init (**required**).\n\n### Run it\n\nThe `DEVPI_PASSWORD` environment variable will set the root password on the\nfirst startup of this image. Set it to something more secure than what I use\nas an example here.\n\n```bash\ndocker run -it -p 3141:3141 \\\n    -e DEVPI_PASSWORD=password \\\n    -v $(pwd)/data-server:/devpi/server \\\n    --name devpi-server jonasal/devpi-server:latest\n```\n\nThe command will also host mount the data directory from the server to your\nlocal folder, in order to persist data between restarts.\n\n\u003e The first time this container is started a full re-index of the upstream PyPi\n\u003e will commence, so the logs might be spammed with \"Committing 2500 new\n\u003e documents to search index.\" for a while.\n\nIt is possible to customize the devpi instance with any of the available\n[arguments][1] by appending them to the command displayed above:\n\n```bash\ndocker run -it \u003c...\u003e jonasal/devpi-server:latest \\\n    --threads 4 \\\n    --debug\n```\n\n\n## Client\n\n###  Environment Variables\n- `DEVPI_URL`: The URL to the devpi instance to connect to (default: `http://localhost:3141/root/pypi`)\n- `DEVPI_USER`: The username to login to the devpi instance with (default: `\"\"`)\n- `DEVPI_PASSWORD`: The password for the user when logging in (default: `\"\"`)\n\n### Run it\n\nThe `DEVPI_URL` environment variable is the only one that needs to be set, and\nit will use the default unless you specify something else. The other two are\noptional, and can be defined for convenience so you do not have to manually\nlogin every time you start this container. Furthermore, if `DEVPI_USER` is set\nbut `DEVPI_PASSWORD` is empty you will be prompted for the password.\n\nThe following command expects that there is a functional devpi instance running\non the local computer, and that the \"root\" user has a password set. The host\nmounted directory may be used to transfer files in and out of the container.\n\n```bash\ndocker run -it --rm --network host \\\n    -e DEVPI_USER=root \\\n    -e DEVPI_PASSWORD=password \\\n    -v $(pwd)/data-client:/devpi/client \\\n    jonasal/devpi-client:latest\n```\n\nImportant note here is that this container uses the \"host\" network, else the\n`localhost` in the URL would just make so that the container tried to contact\nitself and would thus not reach the container running the server program.\n\n\n## Configure pip\n\nFor a quick test to see if the `devpi-server` actually works you can make a\none-off installation like this:\n\n```bash\npip install -i http://localhost:3141/root/pypi simplejson\n```\n\nThe server logs should move and the `pip` installation should be successful.\n\nTo then make this setting a bit more permanent you can edit `~/.pip/pip.conf`\nwith this:\n\n```ini\n[global]\nindex-url = http://localhost:3141/root/pypi\n```\n\nFollowing installations should then be going through your local cache.\n\n\n## Set Up Local Index\n\nBy default devpi creates an index called `root/pypi`, which serves as a proxy\nand cache for [PyPI][4], and you can’t upload your own packages to it.\n\nIn order to upload local packages we need to create another index, and to make\nour lives easier we will also configure it so that it \"inherits\" from the\n`root/pypi` index. What this meas is that if our search for a package in the\nlocal index fails it will fall back to the `root/pypi` index and try to find it\nthere. Thus we can add all our private packages without losing the ability to\nfind all the public ones.\n\nTo achieve this we will start the `devpi-client` container as root (we need\nto be able to make modifications):\n\n```bash\ndocker run -it --rm --network host \\\n    -e DEVPI_USER=root \\\n    -e DEVPI_PASSWORD=password \\\n    -v $(pwd)/data-client:/devpi/client \\\n    jonasal/devpi-client:latest\n```\n\nInside the container we will first create another user:\n\n```bash\ndevpi user -c local password=something_long_and_complicated\n```\n\nThen we will create an index under this new user that inherits from the\n`root/pypi` index:\n\n```bash\ndevpi index -c local/stable bases=root/pypi volatile=False\n```\n\nRestart the container again, but this time specify the new index URL and the\nnew user:\n\n```bash\ndocker run -it --rm --network host \\\n    -e DEVPI_URL=\"http://localhost:3141/local/stable\" \\\n    -e DEVPI_USER=local \\\n    -e DEVPI_PASSWORD=something_long_and_complicated \\\n    -v $(pwd)/data-client:/devpi/client \\\n    jonasal/devpi-client:latest\n```\n\nYou can now upload files from the `/devpi/client` folder to the current index\nby running something similar to this:\n\n```bash\ndevpi upload /devpi/client private_package-0.1.0-py3-none-any.whl\n```\n\nAfter this you should be able to install it by pointing to the new index:\n\n```bash\npip install -i http://localhost:3141/local/stable private_package\n```\n\n\n## Upgrading\n\n\u003e :warning: This is semi-experimental since I am having trouble finding\n\u003e official documentation on the proper way to do this.\n\nThe best guide on upgrading devpi server I could find was [this one][9], so\nI tried to integrate that into the entrypoint. It is not very automated, but\nyou will at least have full control of what it is doing the entire time.\n\n\u003e :information_source: You should also only have to do this procedure when\n\u003e there is a change in the database schema. Such a change [will warrant][10] a\n\u003e **major** version bump, so this process is not necessary if you are just\n\u003e upgrading a **minor** or a **patch** version.\n\nBegin by stopping any of the currently running devpi containers, and then run\nthe same image again with the `/export` folder mounted to initiate an export\nprocess:\n\n```bash\ndocker run -it --rm -e DEVPI_PASSWORD=password \\\n    -v $(pwd)/data-server:/devpi/server \\\n    -v $(pwd)/tmp:/export \\\n    jonasal/devpi-server:old-tag\n```\n\nIf this is successful you should now rename the old data folder (don't delete\nit before you know the new one works):\n\n```bash\nsudo mv data-server data-server.bak\n```\n\nRun the new image with the `/import` folder mounted in order to initiate an\nimport process:\n\n```bash\ndocker run -it --rm -e DEVPI_PASSWORD=password \\\n    -v $(pwd)/data-server:/devpi/server \\\n    -v $(pwd)/tmp:/import \\\n    jonasal/devpi-server:new-tag\n```\n\nWhen this one completes you can go back to running the image normally without\nany of the `import/export` folders mounted. This should most likely give you a\nfunctional upgraded instance of devpi. Cleanup of the extra folders can be done\nwith this simple command\n\n```bash\nsudo rm -r data-server.bak \u0026\u0026 sudo rm -r tmp\n```\n\n\n# Further Reading\n\nI got most of the information I needed to complete this project from the\nfollowing sources, perhaps they are useful for you too:\n\n- [Devpi Quickstart Guide](https://devpi.net/docs/devpi/devpi/stable/+d/quickstart-server.html)\n- [Stefan Scherfke: Getting started with devpi](https://stefan.sofa-rockers.org/2017/11/09/getting-started-with-devpi/)\n- [@kyhau: devpiNotes.md](https://gist.github.com/kyhau/0b54386fe220877310b9)\n- [Mpho Mphego: How I Setup A Private Local PyPI Server Using Docker And Ansible](https://blog.mphomphego.co.za/blog/2021/06/15/How-I-setup-a-private-PyPI-server-using-Docker-and-Ansible.html)\n- [@kyhau: devpiServerUpgrade.md][9]\n\n\n\n\n\n\n\n\n[1]: https://devpi.net/docs/devpi/devpi/stable/+d/userman/devpi_commands.html#devpi-command-reference-server\n[2]: https://devpi.net/docs/devpi/devpi/stable/+d/userman/devpi_commands.html\n[3]: https://doc.devpi.net\n[4]: https://pypi.org/\n[5]: https://pypi.org/project/devpi-server/#history\n[6]: https://pypi.org/project/devpi-client/#history\n[7]: https://hub.docker.com/repository/docker/jonasal/devpi-server/tags?page=1\u0026ordering=last_updated\n[8]: https://hub.docker.com/repository/docker/jonasal/devpi-client/tags?page=1\u0026ordering=last_updated\n[9]: https://gist.github.com/kyhau/7707c6dfa25c2e14e345\n[10]: https://github.com/devpi/devpi/issues/439#issuecomment-1064329177\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjonasalfredsson%2Fdocker-devpi","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjonasalfredsson%2Fdocker-devpi","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjonasalfredsson%2Fdocker-devpi/lists"}