简体   繁体   English

在Centos上启动docker-compose命令时出错

[英]Error launching a docker-compose command on Centos

I'm developing development on a Mac and deploying to a Centos 7.4 install. 我正在Mac上进行开发,并部署到Centos 7.4安装。 When running on the latest docker/docker-compose I'm getting a weird error on one of them after upgrading. 在最新的docker / docker-compose上运行时,升级后我发现其中一个奇怪的错误。

On the Mac the command works as intended. 在Mac上,命令按预期运行。 The setup.sh script executes. setup.sh脚本执行。 On Centos it chokes: 在Centos上它令人窒息:

backend_1 | python: can't open file 'sh': [Errno 2] No such file or directory

The command successfully launched in both environments previously. 该命令先前已在两种环境中成功启动。

version: '2'
services:
  db:
    image: postgres
    volumes_from:
        - data
    depends_on:
        - data

  nginx:
    image: nginx:alpine
    build: nginx/.
    restart: always
    volumes: 
        - ./nginx/nginx.conf:/etc/nginx/conf.d/default.conf:ro
        - ./nginx/ssl-bundle.crt:/etc/nginx/ssl/site_com/ssl_bundle.crt
        - ./nginx/site_com.crt:/etc/ssl/certs/ssl-bundle.crt
        - ./nginx/site.key:/etc/nginx/ssl/site_com/site.key
        - ./nginx/site.key:/etc/ssl/private/site.key
        - static:/usr/share/nginx/html/static
    depends_on:
        - backend
    ports:
        - "80:80"
        - "443:443"
    links:
        - backend:backend


  backend:
    image: colstrom/python:legacy
    build:
        context: .
        dockerfile: backend/Dockerfile
    command: sh docker/setup.sh
    volumes:
        - /usr/src/app
        - static:/code/site/static
    depends_on:
        - db
    expose:
        - "8000"


  data:
    image: cogniteev/echo
    command: echo 'Data Container for PostgreSQL'
    volumes:
      - /var/lib/postgresql/data

volumes:
    static:

Mac 苹果电脑

  • docker-compose version 1.22.0, build f46880f docker-compose版本1.22.0,内部版本f46880f
  • Docker version 18.06.0-ce, build 0ffa825 Docker版本18.06.0-ce,内部版本0ffa825

Centos Centos下

  • docker-compose version 1.22.0, build f46880f docker-compose版本1.22.0,内部版本f46880f
  • Docker version 18.06.0-ce, build 0ffa825 Docker版本18.06.0-ce,内部版本0ffa825

Any ideas? 有任何想法吗?

Your image is likely running python as its entry point, so having command: sh docker/setup.sh could result in the container trying to run python sh docker/setup.sh , which isn't what you want. 您的映像可能正在运行python作为其入口点,因此使用command: sh docker/setup.sh可能导致容器尝试运行python sh docker/setup.sh ,这不是您想要的。 Try replacing your command: directive in the backend declaration with this: 尝试使用以下command:替换后端声明中的command:指令:

entrypoint: [ /bin/sh, docker/setup.sh ]

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM