【发布时间】:2020-01-30 22:52:18
【问题描述】:
我正在尝试使用 Docker,并且正在关注 getting started 文档,但我的测试脚本显示“未找到”。
我正在尝试运行一个脚本:test.sh(仅包含echo "Hello")
我的 docker 目录包含
app/ docker-compose/ Dockerfile test.sh
Dockerfile 包含:
FROM openjdk:8u181
WORKDIR /app
COPY . /app
EXPOSE 69
ENV NAME mer
CMD "test.sh"
我是这样构建的:
$ docker build --tag=mer .
Sending build context to Docker daemon 303.8MB
Step 1/6 : FROM openjdk:8u181
---> 82942d9df443
Step 2/6 : WORKDIR /app
---> Using cache
---> b2586c6519ea
Step 3/6 : COPY . /app
---> 8ecd700feafe
Step 4/6 : EXPOSE 69
---> Running in 343cb5014528
Removing intermediate container 343cb5014528
---> 629cdc57f74e
Step 5/6 : ENV NAME mer
---> Running in 53844c2ea6fd
Removing intermediate container 53844c2ea6fd
---> b952a8f45dc8
Step 6/6 : CMD "test.sh"
---> Running in 1f1ef99503b8
Removing intermediate container 1f1ef99503b8
---> ffe838007e82
Successfully built ffe838007e82
Successfully tagged mer:latest
SECURITY WARNING: You are building a Docker image from Windows against a non-Windows Docker host. All files and directories added to build context will have '-rwxr-xr-x' permissions. It is recommended to double check and reset permissions for sensitive files and directories.
然后像这样运行它:
$ docker run mer:latest
/bin/sh: 1: test.sh: not found
为什么会显示“test.sh: not found”?
我的环境:带有 Docker Desktop 2.1 的 Windows 10 通过 Cygwin 运行命令
【问题讨论】:
标签: docker dockerfile docker-for-windows docker-desktop