1

When I run this command docker build -t hello-world .

I got this kind of error...what should I do...How to copy file to /var/www/html/

Sending build context to Docker daemon  2.048kB

Step 1/3 : FROM php:7.2-apache
 ---> f046c4ead123

Step 2/3 : COPY src/ /var/www/html/

COPY failed: stat /mnt/sda1/var/lib/docker/tmp/docker-builder006125699/src: no such file or directory

1
  • Your Dockerfile is unable to find the src/ relative path you set in the COPY command. Since you wrote a relative path, that path is relative to the location of the Dockerfile. Since you are building against . (your current working directory, which appears to be /mnt/sda1/var/lib/docker/tmp/docker-builder006125699), you should have a src/ dir, if not that error will occur. Jun 14, 2019 at 16:39

2 Answers 2

1

I don’t see any problems with your copy command. Verify that etc actually exists in your working directory: ‘ls -la $(pwd) src/‘ before the docker build command

0

There are two approach:

1) Put al the files in the same directory where the you kept the Dockerfile. And be in that persent directory, then execute the docker run command. You cannot pass any relative path, all files should be in same folder.

2) Put all the required files except the Dockerfile in a diffrent path. Use the "-f- /PATH" option in docker run command from the current directory where your Dockerfile is present. Or you can give the full path of the docker file.


docker build -t docker.io/rohitbasu77/php:7.2-apache -f- /sys/fs/cgroup < Dockerfile

OR

docker build -t docker.io/rohitbasu77/php:7.2-apache -f- /sys/fs/cgroup </root/GIT/otrs5/Dockerfile


Now the root pathe where the files are kept is /sys/fs/cgroup/. you can copy everything from here. put all your folders and file under this root path.


/root/GIT/otrs5/Dockerfile:

FROM php:7.2-apache

ADD . /tmp/fs/cgroup/. #Every thing from your local /sys/fs/cgroup/* is copied to a new folder /tmp/fs/cgroup (if not present will be created)


0

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .