Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

356
Views
Servidor pypi local me dice 403 Prohibido al registrar paquetes

Estoy tratando de implementar un servidor pypi para alojar nuestros paquetes internos. Me he estado tirando de los pelos por el comportamiento de pypi dentro de este contenedor acoplable.

Dockerfile

 FROM python:3.5 RUN apt-get update RUN pip install --upgrade pip RUN pip install -U passlib pypiserver[cache]==1.2.0 RUN mkdir -p /src/pypi/packages EXPOSE 8080 ADD ./htpasswd /src/pypi/htpasswd CMD ["pypi-server", "-p 8080", "-P", "/src/pypi/htpasswd","/src/pypi/packages"]

Bastante sencillo, ¿verdad? Hermano del dockerfile, por supuesto, hay un archivo llamado htpasswd que contiene un par de nombre de usuario/contraseña.

Si realicé los pasos definidos en el archivo de la ventana acoplable localmente (en mi entorno fuera de la ventana acoplable) y luego ejecuté el comando definido anteriormente, ¡funciona! Puedo registrar paquetes en su contra.

Pypi ejecutándose fuera de Dockerfile:

 python setup.py register -r local running register running egg_info writing top-level names to ah_model.egg-info/top_level.txt writing dependency_links to ah_model.egg-info/dependency_links.txt writing ah_model.egg-info/PKG-INFO file foobar_utils.py (for module foobar_utils) not found reading manifest file 'ah_model.egg-info/SOURCES.txt' writing manifest file 'ah_model.egg-info/SOURCES.txt' running check Registering ah_model to http://localhost:8081 Server response (200): OK

Sin embargo, si construyo y ejecuto el dockerfile, luego trato de registrarme dentro de eso, NO funciona:

Pypi ejecutándose dentro de la ventana acoplable:

 python setup.py register -r local running register running egg_info writing top-level names to ah_model.egg-info/top_level.txt writing ah_model.egg-info/PKG-INFO writing dependency_links to ah_model.egg-info/dependency_links.txt file foobar_utils.py (for module foobar_utils) not found reading manifest file 'ah_model.egg-info/SOURCES.txt' writing manifest file 'ah_model.egg-info/SOURCES.txt' running check Registering ah_model to http://localhost:8080 Server response (403): Forbidden

¿Hay algo en el funcionamiento de pypi que requiera ajustes especiales por estar dentro de un contenedor docker? ¿Alguien ha probado esto por sí mismo?

ACTUALIZAR

Parece que el contenedor docker está escuchando en el puerto 8080:

 root@a0ec19c89a9d:/src/pypi# netstat -tulpn Active Internet connections (only servers) Proto Recv-Q Send-Q Local Address Foreign Address State PID/Program name tcp 0 0 0.0.0.0:8080 0.0.0.0:* LISTEN 1/python3.5
about 4 years ago · Santiago Trujillo
1 answers
Answer question

0

Expose no expone los puertos a la máquina host. Para hacerlo, debe usar -p o -P o crear un archivo docker-compose.yml con definiciones de ports .

Consulte https://docs.docker.com/engine/reference/builder/#expose y https://docs.docker.com/compose/compose-file/#ports

about 4 years ago · Santiago Trujillo Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!