2017-06-22 40 views
0

我的搬運工容器能夠成功建立,但是當我輸入命令docker-compose build,將返回以下錯誤:連接到泊塢窗,因爲PostGIS的端口號的集裝箱失敗

Starting docker_etl_1 ... 
Starting 1e5f56853e10_1e5f56853e10_1e5f56853e10_docker_postgis_1 ... 
Starting 1e5f56853e10_1e5f56853e10_1e5f56853e10_docker_postgis_1 
Starting 1e5f56853e10_1e5f56853e10_1e5f56853e10_docker_postgis_1 ... error 

ERROR: for 1e5f56853e10_1e5f56853e10_1e5f56853e10_docker_postgis_1 Cannot start service postgis: driver failed programming external connectivity on endpoint 1e5f56853e10_1e5f56853e10_1e5f56853e10_docker_postgis_1 (91464afbee8bf7212061797ec0f4c017a56cc3c30c9bdaf513127a6e6a4a5a52): Error starting userland prStarting docker_etl_1 ... done 

ERROR: for postgis Cannot start service postgis: driver failed programming external connectivity on endpoint 1e5f56853e10_1e5f56853e10_1e5f56853e10_docker_postgis_1 (91464afbee8bf7212061797ec0f4c017a56cc3c30c9bdaf513127a6e6a4a5a52): Error starting userland proxy: Bind for 0.0.0.0:5432 failed: port is already allocated 

這裏是我的碼頭工人,compose.yaml

version: '2' 
services: 
    postgis: 
    build: ./postgis 
    volumes: 
     - ../src/main/sql:/sql 
    ports: 
     - "5432:5432" 

    etl: 
    build: ./etl 
    volumes: 
     - ..:/national-voter-file 
    entrypoint: 
     - python3 
     - /national-voter-file/load/loader.py 

這裏是Dockerfile:

FROM mdillon/postgis:9.5 

ENV POSTGRES_DB VOTER 

RUN mkdir /sql 
COPY ./dockerResources/z-init-db.sh /docker-entrypoint-initdb.d/ 

EXPOSE 5432 

Docker ps -a個回報:

CONTAINER ID  IMAGE    COMMAND     CREATED    STATUS       PORTS    NAMES 
da74ad97b95c  docker_postgis  "docker-entrypoint..." About a minute ago Created            docker_postgis_1 
5872c6e55fe2  docker_etl   "python3 /national..." About a minute ago Exited (2) About a minute ago      docker_etl_1 

然而,當我嘗試rm $(docker ps -qa)我得到以下錯誤:

rm: da74ad97b95c: No such file or directory 
rm: 5872c6e55fe2: No such file or directory 

我不相信我有另外一個容器中運行的,所以我很困惑該消息Bind for 0.0.0.0:5432 failed: port is already allocated

+0

你可以只檢查是否有任何綁定到端口 - 'lsof的-i4 | grep的5432'等 –

+0

@OliverCharlesworth該命令不返回任何東西。應該是? –

+1

這聽起來像你已經_something_您的系統上運行的已佔用端口5432是否有可能你有一個Postgres的實例已經在主機上運行? – programmerq

回答

1

難道你運行相同的泊塢窗,撰寫更早,這可能失敗或至少沒有清理服務? 嘗試運行docker ps -a檢測是否有任何停止的容器存在。被停止的集裝箱可能會佔用港口。如果是這樣,就清除出來使用docker rm $(docker ps -qa)

+0

我已經用這些命令的輸出更新了我的問題。爲什麼remove命令找不到正確的文件? –

相關問題