由于postgis端口问题,连接到docker集装箱失败
我的docker容器能够成功构build,但是当我input命令docker-compose build
,会返回以下错误:
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
这是我的docker-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
是否有可能你之前运行过相同的docker-compose,可能失败了,或者至less没有清理这些服务? 尝试运行docker ps -a
来检查是否存在任何已停止的容器。 被停止的集装箱可能会占用港口。 如果是这样,只需使用docker rm $(docker ps -qa)
清除它们即可
- Docker容器内运行的Java RMI应用程序无法在Docker主机之外进行通信(即从networking中的不同服务器)
- 使用带虚拟框共享文件夹的Docker机器启动mysql容器
- docker执行官缺less
- 如何看到一个链接的容器为本地主机?
- Dockerfile:在将所需文件复制到图像之前,如何构build项目?
- 如何设置私人registry以在kubernetes群集上部署本地映像?
- 创build主题,但在Kubernetes上使用Python获取Kafka FailedPayloadsError
- docker工人:每个服务一个共享的图像或单独的图像?
- 如何实现Multi-Arch-Docker Image构build的自动化