Keyur Shah
Keyur Shah

Reputation: 11561

assign port docker issue

I am assigning port to my docker Image to run in browser but when I am assigning to port It gives me error like

by executing this command

docker run -d -P 86:5000 secondphp2

> Unable to find image '86:5000' locally docker: Error response from
> daemon: repository 86 not found: does not exist or no pull access. See
> 'docker run --help'.

This is my docker file

FROM php:7.0-apache
COPY / C:\wamp64\www\test
EXPOSE 86

I have successfully created Image with the name of secondphp2, I know that because when I run this command docker ps -a It gives me response like

CONTAINER ID        IMAGE                     COMMAND                  CREATED             STATUS                     PORTS                                          NAMES
fe1840c962c4        secondphp2                "/bin/bash"              2 days ago          Exited (0) 2 days ago                                                     sleepy_bose

Is there something I am missing or any clue for me to solve this Issue?

EDIT

First I have created docker Image file from above docker file by using this command

docker build -t secondphp2 .

after running this command Image was successfully created

REPOSITORY                      TAG                 IMAGE ID            CREATED             SIZE
secondphp2                      latest              7968d546d5fd        2 days ago          346 MB

Upvotes: 0

Views: 1150

Answers (2)

charli
charli

Reputation: 1778

Try:

docker run -d -p 86:5000 secondphp2

The -P (upper case) is not a valid flag. To expose port use -p in lower case.

The order of arguments passed to docker matters:

docker run [OPTIONS] IMAGE [COMMAND] [ARG...]
  • OPTIONS: -p 86:5000 and -d are options.
  • IMAGE: secondphp2
  • ARG: Arguments passed to be executed on the image (for example: /bin/sh -l)

Upvotes: 4

J. Meijers
J. Meijers

Reputation: 989

I'm not allowed to comment on your post, but the error it gives, makes me assume that you're not using the correct syntax when starting your docker. The docker agent is apparently trying to find version 5000 of an image named 86.

Can you show us what you're running to start the docker?

Upvotes: 1

Related Questions