In my Dockerfile I have this line:
RUN ln -s /var/www/html/some_file /var/www/html/another_file
When running docker build all the steps are executed including the creation of the symbolic link, but when I start a container using the image created and check the folder /var/www/html/
I don't see the link there.
I tried searching online if this is something supported by docker and couldn't find an answer.
The content of the container is already available by another container image I am using with the FROM
instruction, so the file /var/www/html/some_file
is not on my machine.
No Volumes are involved. This is the Dockerfile:
FROM piwik:3.2.1-apache
RUN apt update
RUN ln -s /var/www/html/some_file /var/www/html/another_file
CMD [ "apache2-foreground" ]
The Dockerfile for that image (three and a half years old and not getting any updates!) has the line:
VOLUME /var/www/html
This will prevent any subsequent RUN instructions from making any changes to that directory, even if it's in a derived image.
There's no way to un-VOLUME a directory, so if you need this symlink to exist, you either need to create a new image from a base PHP image installing the software yourself, or wrap its entrypoint script with your own that creates the symlink at startup time.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With