Matt Gaunt
Matt Gaunt

Reputation: 9821

Using Docker's CMD to run a Shell Script + Get Output

I've been using a docker file for about 6 months now without issue but after a few changes in compute engine, I'm hitting a weird issue where something in my start up script is behaving the way it should / it used to.

I have a shell script that does a couple tweaks to the environment before starting a web server which is started like so:

ADD src/docker/startup.sh /home/gauntface/docker/startup.sh

CMD /home/gauntface/docker/startup.sh

startup.sh echo's logs but I can't find a way to view these logs, does anyone have any advice?

docker logs shows nothing for my container

Additional Notes

I'm running the docker command with daemon mode. Without Daemon mode, docker throws this error:

the input device is not a TTY

The Docker file and start up script are here:

https://github.com/gauntface/gf-site/blob/staging/src/docker/Dockerfile-base

https://github.com/gauntface/gf-site/blob/staging/src/docker/startup.sh

Upvotes: 3

Views: 4332

Answers (1)

BMitch
BMitch

Reputation: 264761

docker logs by default will show the output from stdout/stderr:

$ docker run -it --name test-it busybox echo hello world
hello world

$ docker logs test-it
hello world

We'd need to know more about your shell script, what output it generates, and what debugging you've done to give a more detailed answer about why it's not working.

Upvotes: 2

Related Questions