【发布时间】:2021-03-08 12:29:54
【问题描述】:
我正在通过 docker-compose 启动容器,但 3 个容器中有 2 个未能说明 -:"exec user process caused "exec format error" "
上述错误是在执行位于/opt/whatsapp/bin/wait_on_postgres.sh 位置的文件时引起的,我需要在此文件顶部添加#!/bin/bash。
问题是,容器很快就退出了,那么如何访问这个文件来进行必要的更改??
下面是我正在使用的 docker-compose.yml -:
version: '3'
volumes:
whatsappMedia:
driver: local
postgresData:
driver: local
services:
db:
image: postgres:10.6
command: "-p 3306 -N 500"
restart: always
environment:
POSTGRES_PASSWORD: testpass
POSTGRES_USER: root
expose:
- "33060"
ports:
- "33060:3306"
volumes:
- postgresData:/var/lib/postgresql/data
network_mode: bridge
wacore:
image: docker.whatsapp.biz/coreapp:v${WA_API_VERSION:?Run docker-compose with env var WA_API_VERSION (ex. WA_API_VERSION=2.31.4 docker-compose <command> <options>)}
command: ["/opt/whatsapp/bin/wait_on_postgres.sh", "/opt/whatsapp/bin/launch_within_docker.sh"]
volumes:
- whatsappMedia:/usr/local/wamedia
env_file:
- db.env
environment:
# This is the version of the docker templates being used to run WhatsApp Business API
WA_RUNNING_ENV_VERSION: v2.2.3
ORCHESTRATION: DOCKER-COMPOSE
depends_on:
- "db"
network_mode: bridge
links:
- db
waweb:
image: docker.whatsapp.biz/web:v${WA_API_VERSION:?Run docker-compose with env var WA_API_VERSION (ex. WA_API_VERSION=2.31.4 docker-compose <command> <options>)}
command: ["/opt/whatsapp/bin/wait_on_postgres.sh", "/opt/whatsapp/bin/launch_within_docker.sh"]
ports:
- "9090:443"
volumes:
- whatsappMedia:/usr/local/wamedia
env_file:
- db.env
environment:
WACORE_HOSTNAME: wacore
# This is the version of the docker templates being used to run WhatsApp Business API
WA_RUNNING_ENV_VERSION: v2.2.3
ORCHESTRATION: DOCKER-COMPOSE
depends_on:
- "db"
- "wacore"
links:
- db
- wacore
network_mode: bridge
【问题讨论】:
-
没有看到镜像的 Dockerfile 或其他关于它是如何构建的细节,进一步诊断这个有点困难。 (图像是否真的有 GNU bash?脚本是否无意中具有 DOS 行结尾?)
-
(与您的问题无关,但您无需在
docker-compose.yml文件中指定network_mode:、links:或expose:;这些选项没有任何作用,尤其是在现代 Docker 中。) -
实际上,这个 docker-compose 文件是为 Whattsapp api 构建的,因此我从 whatsap Business Api 的官方文档中复制了它。所以没有做太多修改。休息一下,我需要检查文件“/opt/whatsapp/bin/wait_on_postgres.sh”中的内容,问题是当容器失败时如何访问这个文件,这个文件是否位于主机操作系统的某个地方?
-
该文件存在于命令
command: ["/opt/whatsapp/bin/wait_on_postgres.sh"中,该路径似乎是在容器内创建的,当它执行该文件时由于存在哪个容器而引发错误,如何访问该文件以修复代码.
标签: docker docker-compose containers