[Solved] Unable to get into the container with /bin/bash

Hello all,

MM version since 10.10 doesn’t work for me. 10.9.1 is ok.
I can’t go into the container with /bin/bash or any command by the way.

Here is my test:

First, i create the postgres container: OK

docker network create mm-net

docker run -d --name mm-db --network mm-net \
  -e POSTGRES_USER=mmuser \
  -e POSTGRES_PASSWORD=mmuser_password \
  -e POSTGRES_DB=mattermost \
  postgres:15

then, the MM container: (v 10.11.1)

docker run --rm -it --network mm-net -p 8065:8065   -e MM_SQLSETTINGS_DRIVERNAME=postgres   -e MM_SQLSETTINGS_DATASOURCE="postgres://mmuser:mmuser_password@mm-db:5432/mattermost?sslmode=disable&connect_timeout=10"   mattermost/mattermost-team-edition:10.11.1

the logs seems ok. but when i try:

docker run --rm -ti mattermost/mattermost-team-edition:10.11.1 bash

i get a :

docker: Error response from daemon: failed to create task for container: failed to create shim task: OCI runtime create failed: runc create failed: unable to start container process: exec: "bash": executable file not found in $PATH: unknown.

But it works with MM v 10.9.1:

docker run --rm -it --network mm-net -p 8065:8065   -e MM_SQLSETTINGS_DRIVERNAME=postgres   -e MM_SQLSETTINGS_DATASOURCE="postgres://mmuser:mmuser_password@mm-db:5432/mattermost?sslmode=disable&connect_timeout=10"   mattermost/mattermost-team-edition:10.9.1

then:

docker run --rm -ti mattermost/mattermost-team-edition:10.9.1 bash
mattermost@77ac23a8b22a:~$ 

Have you got any clue ? i don’t know if it can help but i’ve noted that the size of the images since 10.9.1 has decreased:

mattermost/mattermost-team-edition   10.11.1   c2162e552c13   13 days ago    780MB
mattermost/mattermost-team-edition   10.9.1    55c03d3a3d60   2 months ago   980MB
 

Thank you for any tips !

regards,

f.

Thanks for the detailed repro steps, @fab2! Since recent Mattermost images were slimmed down (hence the size drop) they no longer include bash, so can you try using a POSIX shell instead (e.g., docker exec -it <container> sh or docker run --rm -it --entrypoint sh mattermost/mattermost-team-edition:10.11.1)? Or extend the image to add bash if you need it.

Hey John, thank you for answer.
I must miss something:

FR-PORT:/home/fabricer# docker ps
CONTAINER ID   IMAGE                                        COMMAND                  CREATED         STATUS                   PORTS                                             NAMES
835bd2977d76   mattermost/mattermost-team-edition:10.11.1   "/mattermost/bin/mat…"   2 minutes ago   Up 2 minutes (healthy)   8067/tcp, 0.0.0.0:8065->8065/tcp, 8074-8075/tcp   youthful_bell
17d9ffb64eba   postgres:15                                  "docker-entrypoint.s…"   3 minutes ago   Up 3 minutes             5432/tcp                                          mm-db
FR-PORT:/home/fabricer# docker exec -it 835bd2977d76 sh
OCI runtime exec failed: exec failed: unable to start container process: exec: "sh": executable file not found in $PATH: unknown
FR-PORT:/home/fabricer# docker run --rm -it --entrypoint sh mattermost/mattermost-team-edition:10.11.1
docker: Error response from daemon: failed to create task for container: failed to create shim task: OCI runtime create failed: runc create failed: unable to start container process: error during container init: exec: "sh": executable file not found in $PATH: unknown.

Do you think i should build a Dockerfile ?

f.

Hey,

Finaly, i found my mistake.
In the docker-compose.yml, i’ve used for a while a DB healthcheck that needs curl. And curl is no more in the new image.
Hope it can help !
regards,

f.

So glad to hear you were able to get it figured out, @fab2! And thank you for following up with the solution.

I had the same issue after upgrading from Mattermost 10.5.1 to 10.12.

In the new Docker images, you can’t exec into the container with /bin/bash or /bin/sh anymore because the images are based on a minimal base.

But you can still use mmctl directly inside the container without needing a shell.

For Example:

docker exec mattermost mmctl --local team list
docker exec mattermost mmctl --local user create –email testuser@test.com –username Testuser –password ‘Test@123’