mruanova
mruanova

Reputation: 7085

List port for Docker container using command line

I created an app with react.js and node.js but now I need to use Docker, here is my code:

https://github.com/mruanova/members

I created my Dockerfile and followed the instructions from nodejs.org:

https://nodejs.org/en/docs/guides/nodejs-docker-webapp/

The problem is that when i do:

docker ps

I get nothing:

CONTAINER ID  IMAGE  COMMAND  CREATED  STATUS  PORTS  NAMES

As suggested by the answers here I tried:

docker ps -a

and I get the ID now but not the PORT:

CONTAINER ID  IMAGE  COMMAND  CREATED  STATUS  PORTS  NAMES
123 mruanova/app "node server.js" 7 min ago Exited ? hopeful_williams
987 b7c11ccf6409 "node server.js" 9 min ago Exited ? ecstatic_jennings

Upvotes: 0

Views: 4015

Answers (1)

Matt Morgan
Matt Morgan

Reputation: 5303

Try this:

docker ps -a

The process may be running under a user account other than your own. The -a option lists processes from ALL users.

To show the port, first get the CONTAINER id, then:

docker port CONTAINER

Upvotes: 2

Related Questions