Reputation: 1253
I am new to Docker and trying to build Docker image. I simply created Docker file but getting some error not able to identify how to resolve this.
My Docker file code is:
FROM ubuntu
MAINTAINER ravat
RUN echo “Hello Apache server on Ubuntu Docker” > /home/ravata/Desktop/DockerDemo/index.html
CMD [ "/bin/bash" ]
the error I am getting is:
/bin/sh: 1: cannot create /home/ravata/Desktop/DockerDemo/index.html: Directory nonexistent
Upvotes: 1
Views: 5649
Reputation: 41222
Not sure why are you trying to create the file at this specific location, but as error hints you, you need to create a folder you'd like to put your file first, e.g.
FROM ubuntu
MAINTAINER ravat
RUN mkdir -p /home/ravata/Desktop/DockerDemo/
RUN echo “Hello Apache server on Ubuntu Docker” > /home/ravata/Desktop/DockerDemo/index.html
CMD [ "/bin/bash" ]
Just to make it clear, the reason you do not have home folder for username ravata is the fact that no such user exists on brand new ubuntu docker image.
Upvotes: 1
Reputation: 483
The error message tells you why, /home/ravata/Desktop/DockerDemo/
directory doesn't exists.
You should first create it.
Note that this file will be created inside your container, not on your computer. So directory should be created inside the container, for example with a RUN mkdir ...
Upvotes: 0