2

I'm inside my docker container: This is my working directory

root@19b84a014662:/usr/src/ghost#

I have a script in:

root@19b84a014662:/

I'm able to cd to / and execute the script. But I need to execute the script from my docker-compose file. I tried

./test.sh

But this actually means it's searching in /usr/src/ghost/ for the script instead of / How can I execute the script, in the / of my container?

Example: I ssh into my container:

root@19b84a014662:/usr/src/ghost# ls
Gruntfile.js  LICENSE  PRIVACY.md  README.md  config.example.js  config.js  content  core  index.js  node_modules  npm-shrinkwrap.json  package.json

I have a script in the root of my container. I want to execute it with:

./test.sh

Than it show me only folders/scripts which are in /usr/src/ghost and not in /

root@19b84a014662:/usr/src/ghost# ./
content/      core/         node_modules/
1
  • 2
    /test.sh or RUN /test.sh in a Dockerfile Commented Oct 4, 2016 at 22:17

1 Answer 1

1

Just replace your ./test.sh by

/test.sh

Because ./ means you're starting from current directory (which is the working dir /usr/src/ghost/ in this case). Inspite of this / means you're starting from root directory and that's what you want to do.

Alternatively you could switch to root dir and execute your script in one command using the && concatenator below. But I'll recommend the above.

cd / && ./test.sh
Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.