0
votes

So I'm trying to run Docker from the VS code plug in,

Trying to build a Docker image, to see if it works.

And I get this error message

Executing command: docker run --rm -it -p 3000:3000/tcp -p 5000:5000/tcp ecommerce:latest

docker: Error response from daemon: driver failed programming external connectivity on endpoint clever_hermann (4c4b6a299257d59a8bad812ee498ecbe689a1e134492dfbb8d9da4dc2acfee35): Bind for 0.0.0.0:5000 failed: port is already allocated. The terminal process "/usr/bin/zsh '-c', 'docker run --rm -it -p 3000:3000/tcp -p 5000:5000/tcp ecommerce:latest'" terminated with exit code: 125.

This is my Dockerfile

FROM node:latest

RUN mkdir /app

WORKDIR /app

COPY package.json .

RUN npm install

COPY . .

EXPOSE 3000

EXPOSE 5000

CMD [ "npm", "run", "dev" ]

Any clues on how to continue?

1
Do you have any other app running on your port 5000? (host port, not the guest)mmonteirocl
apparently I do, but I have no idea how to check that out. I dont even know what a port is, in the IT meaning. But issue solved with the answer belowMrFacundo
Of course is solved. Because it's not using the port 5000. The 5000 is not reserved. Maybe you did a npm server run on 5000 or a other servicemmonteirocl
@mommonteirocl I dont understand. What thing is not using port 5000? what does "the port 5000 is not reserved"?MrFacundo

1 Answers

2
votes

This is because some other apps or containers are running on your machine and aquired those port numbers. But still you can run by using port-mapping changes.

docker run --rm -it  -p 8282:3000/tcp -p 8181:5000/tcp ecommerce:latest

In above command you are mapping container port 3000/tcpto your machine localhost:8282 and same for 5000/tcp.

Once containers are running then goto browser http://localhost:8181 and http://localhost:8282 for respective output