Open chadgrant opened 4 years ago
One way to go around this is to perform these tasks outside before build and remove from the dockerfile as mssql in the container does not have access to making these executable depending on how they were copied into the container.
chmod +x configure-db.sh chmod +x entrypoint.sh
I ran into this issue, on my ikemtz/sql_dacpac image. My workaround was to switch to root, make the permission changes, then switch back to mssql user.
Here's a docker file for my image to use as an example: https://github.com/ikemtz/SQL_Dacpac
Thanks @ikemtz - this worked perfectly for me and seems an intuitive solution
A change in the mssql-customize sample and some kind of warning about the issue in te readme file, would be nice.
This work for me:
COPY --chown=root . /usr/config
# Grant permissions for to our scripts to be executable (YAGNI)
# RUN chmod +x /usr/config/entrypoint.sh
# RUN chmod +x /usr/config/configure-db.sh
I had solved my problem with which m4cm3nz explained But now it says: exec ./entrypoint.sh: no such file or directory Any idea?
This worked for me
USER root
# Create a config directory
RUN mkdir -p /usr/config
WORKDIR /usr/config
# Bundle config source
COPY --chown=root . /usr/config
# Grant permissions for to our scripts to be executable
RUN chmod +x /usr/config/entrypoint.sh
RUN chmod +x /usr/config/configure-db.sh
ENTRYPOINT ["bash", "/usr/config/entrypoint.sh"]
Then in notepad++ I had to make sure the line endings were unix: https://stackoverflow.com/a/71324093/19535160
You can also use dos2unix
to automatically change the line-endings. This way, you know for certain that can't go wrong again.
# Install dos2unix
RUN apt update && apt install dos2unix
# Change DOS line-endings to Unix line-endings
RUN dos2unix /usr/config/entrypoint.sh
The mssql user does not have permissions to make files executable, making it difficult to add startup/configure scripts.
the mssql-customize sample included in this repository does not work