Docker 复制无效
Docker COPY doesn't work
我需要帮助 Docker!
#DockerfileCron
FROM node:6
RUN mkdir /www
COPY . /www
WORKDIR /www
RUN apt-get update && apt-get install -y cron
CMD ["cron", "-f"]
当我基于这个 Docker 文件构建图像时,命令 COPY
只是复制 Docker 文件并忽略文件夹中的所有其他文件。
# construção das imagens
docker build -t job/job_cronjob - < DockerfileCron
# executa o cron
docker run -d \
--name job_cronjob job/job_cronjob
我该如何解决这个问题?
docker build -t job/job_cronjob - < DockerfileCron
问题:"This will read a Dockerfile from STDIN without context. Due to the lack of a context, no contents of any local directory will be sent to the Docker daemon. Since there is no context, a Dockerfile ADD only works if it refers to a remote URL." - https://docs.docker.com/engine/reference/commandline/build/#build-with--
解决方案:使用-f
标志指定Dockerfile:
docker build -t job/job_cronjob -f DockerfileCron .
我需要帮助 Docker!
#DockerfileCron
FROM node:6
RUN mkdir /www
COPY . /www
WORKDIR /www
RUN apt-get update && apt-get install -y cron
CMD ["cron", "-f"]
当我基于这个 Docker 文件构建图像时,命令 COPY
只是复制 Docker 文件并忽略文件夹中的所有其他文件。
# construção das imagens
docker build -t job/job_cronjob - < DockerfileCron
# executa o cron
docker run -d \
--name job_cronjob job/job_cronjob
我该如何解决这个问题?
docker build -t job/job_cronjob - < DockerfileCron
问题:"This will read a Dockerfile from STDIN without context. Due to the lack of a context, no contents of any local directory will be sent to the Docker daemon. Since there is no context, a Dockerfile ADD only works if it refers to a remote URL." - https://docs.docker.com/engine/reference/commandline/build/#build-with--
解决方案:使用-f
标志指定Dockerfile:
docker build -t job/job_cronjob -f DockerfileCron .