I have set up two containers for Nginx and NodeJS in Ubuntu 16.04 Xenial on AWS. I use docker-compose. Everything works fine.
I would like to look into the Nginx container. For the same I use the command:
sudo docker exec -it <container-name> bash
And I get the following error
oci runtime error: exec failed: container_linux.go:265: starting container process caused "exec: \"bash\": executable file not found in $PATH"
The path is (using echo $PATH)
/home/ubuntu/bin:/home/ubuntu/.local/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin
The docker-compose.yml is:
version: "0.9"
services:
nginx:
build: ./nginx
restart: always
ports:
- "80:80"
- "443:443"
volumes:
- /etc/letsencrypt/:/etc/letsencrypt/
links:
- node:node
node:
build: ./node
restart: always
ports:
- "8080:8080"
volumes:
- ./node:/usr/src/app
- /usr/src/app/node_modules
How do I access the container? Thanks
Are you sure that bash interpreter is available in your docker image ? It is not available in base alpine image for example.
You can try starting the container with :
sudo docker exec -it <container-name> sh
And see if the error still occurs.
BTW, usermod -aG docker <username>
will allow you not to use sudo anymore to run docker command as user <username>
.