skip to Main Content

I’m trying to get my hands on Docker and write my own gitea image without using docker compose.

The snippet of code that doesn’t seem to be working is below, the second line is what returns an error.

RUN useradd -u 8877 test
RUN wget -O /tmp/gitea <link> && mv /tmp/gitea /home/test && chmod +x /home/test/gitea

However, when moving my file from the tmp to "test" users home directory (I run the dockerfile as root), it claims that the gitea file doesn’t exist. I can’t see any issue in the paths, I expect it all to run without an issue as in my eyes, that directory exists.

Error message:

cannot access '/home/test/gitea': Not a directory

Is my pathing wrong or have I gone wrong somewhere else?

Edit from answer: Downloading directly to that directory throws the same error "No such file or directory"

2

Answers


  1. Chosen as BEST ANSWER

    Solved!

    Turns out creating a user doesn't create a directory for them. Adding the flags -rm -d into the "useradd" adds a /home/user directory and therefore the pathing now exists.


  2. Why not download directly?

    RUN wget -O /home/test/gitea <link> && chmod +x /home/test/gitea
    
    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search