Zuriar
Zuriar

Reputation: 11744

Mount data volume, then create symbolic link at container creation in docker

When docker-compose creates the container, is it possible to create a symbolic link from volume-mounted directory to another location in container?

I know it can be done in the Dockerfile, but I wont have the data volume mounted at the moment of building the image.

Upvotes: 1

Views: 1507

Answers (1)

BMitch
BMitch

Reputation: 263886

You can create a symbolic link to a file or directory that doesn't exist. And you can also mount a volume over top of an existing file/directory and the symbolic link will point to the newly mounted contents. So add the link inside your Dockerfile to the image.

Upvotes: 1

Related Questions