work_dir标记在docker-compose yml文件中的含义是什么

时间:2016-10-31 12:12:11

标签: docker-compose dockerfile

只是想知道work_dir文件对于通过docker-compose加载的图像真正起了什么作用。示例docker-compose.yml文件如下:

dev:
    extends:
        file: common.yml
        service: workspace
    volumes:
        - $ATOMSPACE_SOURCE_DIR:/atomspace
        - $COGUTILS_SOURCE_DIR:/cogutils
        # Uncomment the following lines if you want to work on moses
        # - $MOSES_SOURCE_DIR:/moses
    working_dir: /opencog # This is the same as the volume mount point below
    links:
        - postgres:db
        - relex:relex

postgres:
    image: opencog/postgres
    # Uncomment the following lines if you want to work on a production
    # system.
    # NOTE: The environment variable `PROD` is set `True` then the entrypoint
    # script in opencog/postgres does additional configurations.
    # environment:
    #     - PROD=True

relex:
    image: opencog/relex
    command: /bin/sh -c "./opencog-server.sh"

1 个答案:

答案 0 :(得分:8)

working_dir设置创建的容器的工作目录。它与--workdir的{​​{1}}标志相同。