0

I've tried for a long time to work out what my mistake is in the command I am running but just fail to see the problem.

Here is the docker command that runs on the gitlab runner

docker build --file docker/myapp.Dockerfile --tag apphouse/myapp --tag apphouse/myapp:8ea7b80 --build-arg HTTP_PROXY=http://192.168.121.130:3128 --build-arg HTTPS_PROXY=http://192.168.121.130:3128 --build-arg http_proxy=http://192.168.121.130:3128 --build-arg https_proxy=http://192.168.121.130:3128 --build-arg NO_PROXY=10.61.61.5:80,dind:2375,dind:2376,docker:2375,docker:2376,172.20.38.37,172.20.36.45,172.20.36.29,docker.inf.ryui.lk,nexus.inf.ryui.lk,10.61.61.20,10.61.61.3,gitlab.internal1.lk --build-arg no_proxy=10.61.61.5:80,dind:2375,dind:2376,docker:2375,docker:2376,172.20.38.37,172.20.36.45,172.20.36.29,docker.inf.ryui.lk,nexus.inf.ryui.lk,10.61.61.20,10.61.61.3,gitlab.internal1.lk

Error

"docker build" requires exactly 1 argument.
See 'docker build --help'.
Usage:  docker build [OPTIONS] PATH | URL | -
Build an image from a Dockerfile

Here's some output to see where the script is running from

Output of 'pwd'

/home/gitlab-runner/builds/wV5dDxY4/0/apphouse/myapp

Output of 'ls -lrth'

total 24K
-rw-rw-r-- 1 gitlab-runner gitlab-runner  820 Mar  4 18:36 README.md
-rw-rw-r-- 1 gitlab-runner gitlab-runner  134 Mar  4 18:36 local-config.yml
drwxrwxr-x 2 gitlab-runner gitlab-runner   47 Mar  4 18:36 lib
-rwxrwxr-x 1 gitlab-runner gitlab-runner 8.1K Mar  5 00:12 myapp
drwxrwxr-x 2 gitlab-runner gitlab-runner   39 Mar  5 12:15 scripts
drwxrwxr-x 3 gitlab-runner gitlab-runner   95 Mar  5 12:15 docker
1
  • Do you have a directory name at the end after all of those options, usually .? Commented Mar 4, 2022 at 23:32

1 Answer 1

1

Try this:

docker build --tag apphouse/myapp \
    --tag apphouse/myapp:8ea7b80 \
    --build-arg HTTP_PROXY=http://192.168.121.130:3128 \
    --build-arg HTTPS_PROXY=http://192.168.121.130:3128 \
    --build-arg http_proxy=http://192.168.121.130:3128 \
    --build-arg https_proxy=http://192.168.121.130:3128 \
    --build-arg NO_PROXY=10.61.61.5:80,dind:2375,dind:2376,docker:2375,docker:2376,172.20.38.37,172.20.36.45,172.20.36.29,docker.inf.ryui.lk,nexus.inf.ryui.lk,10.61.61.20,10.61.61.3,gitlab.internal1.lk \
    --build-arg no_proxy=10.61.61.5:80,dind:2375,dind:2376,docker:2375,docker:2376,172.20.38.37,172.20.36.45,172.20.36.29,docker.inf.ryui.lk,nexus.inf.ryui.lk,10.61.61.20,10.61.61.3,gitlab.internal1.lk \
    --file docker/myapp.Dockerfile .
Sign up to request clarification or add additional context in comments.

7 Comments

Thank you Hussain. I tried 2 things & both fail 1st I tried your answer. It fails with the error - unable to prepare context: unable to evaluate symlinks in Dockerfile path: lstat /home/gitlab-runner/builds/wV5dDxY4/0/apphouse/myapp/docker/Dockerfile: no such file or directory
I also tried docker/myapp.Dockerfile This failed with the error - unable to prepare context: context must be a directory: /home/gitlab-runner/builds/wV5dDxY4/0/apphouse/myapp/docker/myapp.Dockerfile
can you post content of your dockerfile. You would most probably need to mount required files in docker, so you can access it inside the docker container. See docs.docker.com/storage/volumes
Updated the question with dockerfile contents
Can you rename "myapp.Dockerfile" to "DockerFile" and try again the command I posted in my answer.
|

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.