Docker Community Forums

Share and learn in the Docker community.

HEALTHCHECK starting container process caused invalid environment USERNAME

docker

(Dsaydon) #1

After adding to my docker file the health check:
HEALTHCHECK --interval=2m --timeout=30s --retries=5 CMD curl -r http://localhost:1234/healthstatus || exit 1

I’m getting unhealthy alert under the status in docker ps (the container is up):
Up About an hour (unhealthy)

after checking the health log I can see the output:
docker inspect --format=’{{json .State}}’ my_service | jq .

{
“Health”: {
“Log”: [
{
“Output”: “rpc error: code = 2 desc = oci runtime error: exec failed: container_linux.go:247: starting container process caused “invalid environment ‘USERNAME’”\n”,
“ExitCode”: -1,
“End”: “2017-12-10T10:28:42.274606327Z”,
“Start”: “2017-12-10T10:28:42.241716647Z”
},
{
“Output”: “rpc error: code = 2 desc = oci runtime error: exec failed: container_linux.go:247: starting container process caused “invalid environment ‘USERNAME’”\n”,
“ExitCode”: -1,
“End”: “2017-12-10T10:30:42.313609006Z”,
“Start”: “2017-12-10T10:30:42.274847833Z”
},
{
“Output”: “rpc error: code = 2 desc = oci runtime error: exec failed: container_linux.go:247: starting container process caused “invalid environment ‘USERNAME’”\n”,
“ExitCode”: -1,
“End”: “2017-12-10T10:32:42.347550172Z”,
“Start”: “2017-12-10T10:32:42.313834355Z”
},
{
“Output”: “rpc error: code = 2 desc = oci runtime error: exec failed: container_linux.go:247: starting container process caused “invalid environment ‘USERNAME’”\n”,
“ExitCode”: -1,
“End”: “2017-12-10T10:34:42.380622433Z”,
“Start”: “2017-12-10T10:34:42.347742726Z”
}
],
“FailingStreak”: 4,
“Status”: “starting”
},

when i’m doing docker exec with the same command it works fine:
docker exec -it my_service curl -r http://localhost:1234/healthstatus || exit 1
output: ok

any idea how to fix this?