dockernginxln

How do I fix ln -s not working in Docker?


Step 3/10 : RUN mkdir -p /etc/nginx/{sites-available,sites-enabled}
Step 4/10 : COPY nginx.conf /etc/nginx/
Step 5/10 : COPY sites-available/*.conf /etc/nginx/sites-available/
Step 6/10 : RUN ln -s /etc/nginx/sites-available/* /etc/nginx/sites-enabled/
 ---> Running in a2f39a3fd6b3
ln: /etc/nginx/sites-enabled/: No such file or directory
ln: /etc/nginx/sites-enabled/: No such file or directory
ln: /etc/nginx/sites-enabled/: No such file or directory
ln: /etc/nginx/sites-enabled/: No such file or directory
ln: /etc/nginx/sites-enabled/: No such file or directory
ln: /etc/nginx/sites-enabled/: No such file or directory
ln: /etc/nginx/sites-enabled/: No such file or directory
ln: /etc/nginx/sites-enabled/: No such file or directory
The command '/bin/sh -c ln -s /etc/nginx/sites-available/* /etc/nginx/sites-enabled/*' returned a non-zero code: 1

Any clue why this isn't working? ^^ I tried all these commands outside of a docker container and it seemed to work


Solution

  • This could be solved by copying the files directly to the sites-enabled directory with the following statement:

    COPY sites-available/*.conf /etc/nginx/sites-enabled/