简体   繁体   中英

I develop on Windows and my production is on Linux, how can I do properly the docker-compose file?

Actually I have something like that for my development environment on Windows 10 (not the entire file) :

db:
    image: mysql:5.6
    ports:
      - "3307:3306"
    environment:
      - "MYSQL_ROOT_PASSWORD=password"
      - "MYSQL_USER=root"
      - "MYSQL_PASSWORD=password"
      - "MYSQL_DATABASE=simtp"

engine:
    build: ./docker/engine/
    volumes:
        - "c:/working_directory/simtp:/var/www/docker:rw"
        - "c:/working_directory/simtp/docker/engine/php.ini:/usr/local/etc/php/conf.d/custom.ini:ro"
    links:
        - "db:db"
    working_dir: "/var/www/simtp"

The problem is on Windows paths. How can I do properly the thing? When I'll run docker-compose on production it will be sure that I'll receive an error.

Thanks.

Use relative paths in your docker-compose.yml:

db:
    image: mysql:5.6
    ports:
      - "3307:3306"
    environment:
      - "MYSQL_ROOT_PASSWORD=password"
      - "MYSQL_USER=root"
      - "MYSQL_PASSWORD=password"
      - "MYSQL_DATABASE=simtp"

engine:
    build: ./docker/engine/
    volumes:
        - "./:/var/www/docker:rw"
        - "./docker/engine/php.ini:/usr/local/etc/php/conf.d/custom.ini:ro"
    links:
        - "db:db"
    working_dir: "/var/www/simtp"

Instruct them to put the docker-compose.yml file in c:/working_directory/simtp or where their files are

Regards

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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