jmervine
jmervine

Reputation: 733

Docker container exits on non-zero exit status

I have a Docker image whose CMD is /bin/bash to allow user interaction with tools contained within. I'm having an issue where if a command run on the bash prompt exits with a non-zero exit status -- e.g. $ badcmd -- the container exits. I'd like to be able to execute multiple commands in the container, keeping it open even if a specific command fails.

My run command is:

docker run --rm -it <image>

I've tried adding --sig-proxy=false, but as it states in the help message, that works on non-TTY mode only.

Additionally, I tried:

docker run --rm -i --sig-proxy=false <image>

This get's me slightly closer, but not in a really usable way as it allows for shell interaction, but omit's the bash prompt -- which while functional, it's really viable.

Docker version info:

Client version: 1.5.0
Client API version: 1.17
Go version (client): go1.4.1
Git commit (client): a8a31ef
OS/Arch (client): linux/amd64
Server version: 1.5.0
Server API version: 1.17
Go version (server): go1.4.1
Git commit (server): a8a31ef

Thanks for any help!

Cheers, J

Upvotes: 2

Views: 4996

Answers (1)

jmervine
jmervine

Reputation: 733

The issue turned out to be because of a set -e in a script that was being sourced in the .bashrc. Thanks @jwodder!

Upvotes: 1

Related Questions