运行docker时没有这样的文件或目录

时间:2017-08-17 01:12:51

标签: python docker

我有一个python文件LOGS_PATH,它只读取logs_path = os.getenv("LOGS_PATH", "/logs/proxy.log") fileHandler = logging.FileHandler(logs_path) 环境变量,并使用它来创建目标的日志目录。

proxy.log

我的docker文件有以下内容,请注意我创建了logs目录和EXPOSE 8000 CMD mkdir /logs CMD touch /logs/proxy.log CMD python server.py 文件。

docker build -t rank
docker run --rm -it --net=host -p 8000:8000 --env-file=.env-co --name=rank rank

然后我构建了docker镜像并运行它,如下所示。

IOError: [Errno 2] No such file or directory: '/logs/proxy.log'

但是当我运行它时,它会爆炸。它说contactPicker.predicateForEnablingContact = [NSPredicate predicateWithFormat:@"!(identifier IN %@)", arrayOfPreviouslySelected];

1 个答案:

答案 0 :(得分:2)

Dim myLastRow As Long Dim clearCell As Long Application.ScreenUpdating = False 'Use a "With" block to save typing Worksheets("Stow") in lots of places '(e.g. within the block we can type ".Cells" instead of "Worksheets("Stow").Cells" and ' ".Rows" instead of "Worksheets("Stow").Rows") With Worksheets("Stow") ' Find last row myLastRow = .Cells(.Rows.Count, "C").End(xlUp).Row ' Loop through range For clearCell = 4 To myLastRow ''Clear any cells with a value of "" 'If .Cells(clearCell, "C").Value = "" Then .Cells(clearCell, "C").Clear 'Clear any cells with a value of "-" If .Cells(clearCell, "C").Value = "-" Then .Cells(clearCell, "C").Clear Next clearCell End With Application.ScreenUpdating = True CMD是不同的事情。使用方式:

RUN

CMD是在运行时表示容器的命令,图像只能有一个CMD(最后一个是唯一有效的CMD)。执行EXPOSE 8000 RUN mkdir /logs RUN touch /logs/proxy.log CMD python server.py 时会执行RUN。