3

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

1
  • From the error message it sounds like you need to run docker with the -t option to allocate a pseudo tty to the process. Possibly -i to keep stdin open as well Commented Aug 6, 2016 at 22:32

1 Answer 1

2

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.

Sign up to request clarification or add additional context in comments.

3 Comments

Thanks for the feedback. I've added links to the startup script. I noticed you weren't using daemon mode which I was, but running without daemon on computer engine throws an error (again added to original question)
if you docker exec -it container_id bash and then launch your startup.sh, do you have your logs?
As Matt indicates in the comment above, you need to include a -t if you need a tty. You can run with -itd which will detach but make available stdin and a tty for when you later attach. Logs will work just fine with -d.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.