ruk·si

🐋 Docker
Error Codes

Updated at 2018-01-09 09:03

docker run will return the error code of the last command ran inside the container.

docker run --rm python:3.6 bash -c "true"; echo $?
# => 0

docker run --rm python:3.6 bash -c "false"; echo $?
# => 1

docker run --rm python:3.6 bash -c "false
false"; echo $?
# => 1

docker run --rm python:3.6 bash -c "true
false"; echo $?
# => 1

docker run --rm python:3.6 bash -c "true
true"; echo $?
# => 0

docker run --rm python:3.6 bash -c "true
true
false"; echo $?
# => 1

docker run --rm python:3.6 bash -c "false
false
false
false
true"; echo $?
# => 0