Reputation: 45
fellows I need help with Docker!
#DockerfileCron
FROM node:6
RUN mkdir /www
COPY . /www
WORKDIR /www
RUN apt-get update && apt-get install -y cron
CMD ["cron", "-f"]
When I build an image based on this Dockerfile, the command COPY
just copy Dockerfile and ignore all other files in the folder.
# construção das imagens
docker build -t job/job_cronjob - < DockerfileCron
# executa o cron
docker run -d \
--name job_cronjob job/job_cronjob
How can I fix this?
Upvotes: 4
Views: 1984
Reputation: 289
docker build -t job/job_cronjob - < DockerfileCron
Problem: "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--
Solution: Use -f
flag for specifying Dockerfile:
docker build -t job/job_cronjob -f DockerfileCron .
Upvotes: 4