nad87563
nad87563

Reputation: 4072

Unable to run shell script using dockerfile

I am new to docker and I just wanted to copy the shellscript inside the container and I wanted to execute the shellscript.

Dockerfile:

FROM amazonlinux

WORKDIR /opt

ADD ./test_Install.sh /opt/test_Install.sh

RUN chmod 777 /opt/test_Install.sh

WORKDIR /

RUN ./test_Install.sh

Build image: docker build -t "testinstallscript:dockerfile" .

When I use the command "docker build -t "testinstallscript:dockerfile" ." I get the following error:

standard_init_linux.go:178: exec user process caused "no such file or directory"

The command '/opt/test_Install.sh' returned a non-zero code: 1

Can anyone tell me what i am doing wrong here?

Upvotes: 0

Views: 1426

Answers (2)

nad87563
nad87563

Reputation: 4072

The below command worked: RUN bash /opt/test_install.sh

Upvotes: -1

NastyDiaper
NastyDiaper

Reputation: 2558

You need to change RUN ./test_Install.sh to utilize ENTRYPOINT or CMD. RUN executes commands in a new layer creating new image so use it when setting up your container.

Upvotes: 2

Related Questions