Errol Hassall
Errol Hassall

Reputation: 416

Docker doesn't have permission to execute bash file

I have followed a guide to dockerise an Elixir/Phoenix project and I created a bash script, but docker doesn't have permssion to execute the file. I ran

docker-compose build
chmod u+x entrypoint.sh 
docker-compose up

despite running the commands it still doesn't have permission. What am I doing wrong?

Upvotes: 2

Views: 7256

Answers (2)

Nilesh Gule
Nilesh Gule

Reputation: 1621

As mentioned by VonC, you might need to create a custom docker image. Copy the file inside the image and then change the permission. You can look at an example of initializing a SQL Server 2017 database using entry point.sh at

https://www.handsonarchitect.com/2018/01/build-custom-sql-server-2017-linux.html

Upvotes: 1

VonC
VonC

Reputation: 1324278

It is better to do the chmod inside a custom Dockerfile, build your own image, and run it through docker-compose as shown below,

RUN chmod +x entrypoint.sh

Doing it directly on the host works only if the docker compose is mounting that file as a volume bind when running the image..

Upvotes: 3

Related Questions