2017-03-17 2 views
1

内部パッケージをホストするためにpypi-serverを導入しようとしています。私はこのドッカーコンテナの中のピピの動きに髪を引っ張ってきました。ローカルのpypiサーバーから通知されます。403パッケージ登録時に禁止されています

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"] 

かなり簡単、右?姉妹のdockerfileにはもちろん、htpasswdという名前のファイルがあり、ユーザー名とパスワードのペアが入っています。

私がdockerファイルに定義されている手順をローカルに(ドッカー以外の環境で)実行し、上記で定義したコマンドを実行すると、動作します。私はそれに対してパッケージを登録することができます。

は、PyPI 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 

しかし、私が構築しdockerfileを実行する場合、それは動作しません、その内部で登録しよう:

は、PyPIがドッキングウィンドウ内で実行されています:

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 

そのrequiが動作しますは、PyPI方法についての何かがありますドッカーのコンテナの中にいるための特別な調整?誰もがこれを試しましたか?ドッキングウィンドウコンテナは、ポート8080でリッスンしているよう

UPDATE

はルックス:

[email protected]:/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 
+0

を参照してください。 –

+0

ドッカーコンテナが設定した方法で8080を聞いていないと言っていますか?その場合は、上記の更新をご覧ください。コンテナは8080でリッスンしているようです。ウェブブラウザをポイントすると、ピピの通常のスプラッシュページが表示されます(ピピサーバへようこそ)。 – melchoir55

答えて

2

は公開ホストマシンにポートを公開しません。これを行うには、-pまたは-Pを使用するか、ports定義のdocker-compose.ymlファイルを作成する必要があります。

を使用すると、ビルド時に実行されていない容器内のポート8080でサービスを利用しようとしているように見えますhttps://docs.docker.com/engine/reference/builder/#exposehttps://docs.docker.com/compose/compose-file/#ports

+1

これはあまりにも遅く働くときに起こります。ありがとうございました。 – melchoir55

関連する問題