Docker Community Forums

Share and learn in the Docker community.

Docker-Compose not displaying the ports


(Sharath Kumar) #1

The docker-compose ps command does not display the ports of the container. What may be the possible reason? this is my docker-compose.yml file

web:
build: .
#command: docker exec -p 4000:4000 mix phoenix.new helloworld3
volumes:
- .:/app
ports:
- “4000:4000”

user:~/composeexample/example1$ docker-compose ps
Name Command State Ports

test1 /bin/bash Up

Can we use a docker command inside the docker-compose file(as in the comment)? I am still new to docker so any help will be appreciated. Thank you.


(Eder Roger de Souza) #2

Hi maybe your docker image contains some errors, then on your container crashes on start. Try run $ sudo docker ps if your container does not appear try $ docker ps -a , Try see logs $ docker logs "your_container_name_or_id"
About running commands, docker-compose works fine , see my example : docker-compose .
See more in:[ https://docs.docker.com/compose/compose-file/](Docker compose reference)