stevec
stevec

Reputation: 52218

Docker doesn't map to a different port?

If I understand the command docker run correctly, docker run -p 3000:3000 someimage publishes port 3000 in the container to port 3000 on localhost. I'm testing this with the 'getting-started' node app, and it works as expected.

But I thought that docker run -p 3000:3001 someimage would publish what's on port 3000 inside the docker contain to localhost:3001, but instead of seeing the application, the browser shows:

This site can’t be reached

This seems pretty straight forward, what am I doing wrong here?

Upvotes: 0

Views: 920

Answers (1)

rpatel3001
rpatel3001

Reputation: 145

The first number is the outside port. To map conatiner port 3000 to host port 3001, use -p 3001:3000

Upvotes: 2

Related Questions