我克隆了一个使用docker-compose的github docker设置。如果作者证实,代码运行良好,我认为我在配置期间遗漏了一些东西
根据说明我运行以下命令:
EXPERIMENT=${linear} docker-compose up --build
我的docker-compose.yml有以下代码:
cph:
build: ./cph
dockerfile: Dockerfile.${EXPERIMENT}
volumes:
- ../deepsurv:/DeepSurv/deepsurv
- ./scripts:/scripts
- ./data/${EXPERIMENT}:/shared/data
- ./results/${EXPERIMENT}:/shared/results
deepsurv:
build: ./deepsurv
dockerfile: Dockerfile.${EXPERIMENT}
volumes:
- ../deepsurv:/DeepSurv/deepsurv
- ./scripts:/scripts
- ./data/${EXPERIMENT}:/shared/data
- ./results/${EXPERIMENT}:/shared/results
rsf:
build: ./rsf
dockerfile: Dockerfile.${EXPERIMENT}
volumes:
- ../deepsurv:/DeepSurv/deepsurv
- ./scripts:/scripts
- ./data/${EXPERIMENT}:/shared/data
- ./results/${EXPERIMENT}:/shared/results
我使用变量Experiment = linear来调用第一个docker但是我收到了警告并出现以下错误:
WARNING: The linear variable is not set. Defaulting to a blank string.
Building cph
ERROR: Cannot locate specified Dockerfile: Dockerfile.
我的docker-compose.yml的结构如下: / DeepSurv / experiments $ tree
/ DeepSurv / experiments $ tree
.
├── cph
│ ├── Dockerfile.gaussian
│ ├── Dockerfile.gbsg
│ ├── Dockerfile.linear
│ ├── Dockerfile.metabric
│ ├── Dockerfile.support
│ ├── Dockerfile.treatment
│ └── Dockerfile.whas
├── data
│ ├── gaussian
│ │ └── gaussian_survival_data.h5
│ ├── gbsg
│ │ └── gbsg_cancer_train_test.h5
│ ├── linear
│ │ ├── linear_survival_data.h5
│ │ └── logs
│ │ └── tensorboard_
│ │ └── shared
│ │ └── data
│ │ ├── linear_survival_data.h5_320635bd-e6f6-49f9- ba02-2d2aba6d25d2
│ │ │ └── events.out.tfevents.1501950449.ebe916c018ac
│ │ ├── linear_survival_data.h5_88d7b4e3-5a3b- 4380-8b22-7c7a4b0aa1ee
│ │ │ └── events.out.tfevents.1501951016.152ea285d90e
│ │ ├── linear_survival_data.h5_e215d084-3302-4248-939d-f5e43cfe63b5
│ │ │ └── events.out.tfevents.1501950494.152ea285d90e
│ │ └── linear_survival_data.h5_ea209c15-00d7-4a57-8fc8-046e08038eba
│ │ └── events.out.tfevents.1501950372.411602be3a6f
│ ├── metabric
│ │ └── metabric_IHC4_clinical_train_test.h5
│ ├── support
│ │ ├── logs
│ │ │ └── tensorboard_
│ │ │ └── shared
│ │ │ └── data
│ │ │ ├── support_train_test.h5_b1f908ae-d03c-4f7c-aab9- ae01ac9d31f7
│ │ │ │ └── events.out.tfevents.1501953943.cd9ea224808d
│ │ │ └── support_train_test.h5_df8bcb48-c77e-46f8- b33c-112cb940a285
│ │ │ └── events.out.tfevents.1501954035.bf1b5f1da709
│ │ └── support_train_test.h5
│ ├── treatment
│ │ └── sim_treatment_dataset.h5
│ └── whas
│ └── whas_train_test.h5
├── deepsurv
│ ├── Dockerfile.gaussian
│ ├── Dockerfile.gbsg
│ ├── Dockerfile.linear
│ ├── Dockerfile.metabric
│ ├── Dockerfile.support
│ ├── Dockerfile.treatment
│ ├── Dockerfile.whas
│ └── models
│ ├── gaussian_model_0.json
│ ├── gaussian_model_selu_revision.0.json
│ ├── gaussian_model_selu_revision.1.json
│ ├── gbsg_model_selu_revision.0.json
│ ├── gbsg_selu_adam_model_0.json
│ ├── linear_model_selu_0.json
│ ├── linear_model_selu_revision.0.json
│ ├── linear_model_selu_revision.json
│ ├── metabric_IHC4_clinical_adam_0.json
│ ├── metabric_model_selu_revision.0.json
│ ├── support_model_selu_revision.0.json
│ ├── support_selu_model_adam_0.json
│ ├── treatment_adam_selu_model_0.json
│ ├── treatment_model_selu_revision.0.json
│ ├── whas_model_selu_0.json
│ └── whas_model_selu_revision.0.json
├── docker-compose-original.yml
├── docker-compose.yml
├── README.md
├── rsf
│ ├── Dockerfile.gaussian
│ ├── Dockerfile.gbsg
│ ├── Dockerfile.linear
│ ├── Dockerfile.metabric
│ ├── Dockerfile.support
│ ├── Dockerfile.treatment
│ └── Dockerfile.whas
└── scripts
├── cph_run.py
├── deepsurv_run.py
docker撰写的版本是:
docker-compose version
docker-compose version 1.8.0, build unknown
docker-py version: 1.9.0
CPython version: 2.7.12
OpenSSL版本:OpenSSL 1.0.2g 2016年3月1日
你能帮助我克服这个错误吗?
答案 0 :(得分:0)
我认为你应该使用:
EXPERIMENT=linear docker-compose up --build
您希望它使用实际的单词“linear”
刚试过:
.
├── cph
│ └── Dockerfile.linear
└── docker-compose.yml
和这个docker-compose.yml
cph:
build: ./cph
dockerfile: Dockerfile.${EXPERIMENT}
和Dockerfile.linear:
FROM alpine:latest
和上面提到的命令,它就像这样工作。您必须从docker-compose.yml文件所在的文件夹运行docker-compose命令,其余文件夹需要相对于该文件夹。