ksl
ksl

Reputation: 4719

docker run reporting an error for port mapping

I have installed Docker Desktop for Mac and I'm trying to run Jenkins in a docker container.

When I attempt to run the following command:

docker run --name jenkinsci -p 8080:8080 jenkins/jenkins:lts

the following error is reported:

unknown shorthand flag: 'p' in -p

I've been through Get started with Docker Desktop for Mac successfully so I know docker is working correctly.

Docker version details:

Client: Docker Engine - Community
 Version:           18.09.2
 API version:       1.39
 Go version:        go1.10.8
 Git commit:        6247962
 Built:             Sun Feb 10 04:12:39 2019
 OS/Arch:           darwin/amd64
 Experimental:      false

Server: Docker Engine - Community
 Engine:
  Version:          18.09.2
  API version:      1.39 (minimum version 1.12)
  Go version:       go1.10.6
  Git commit:       6247962
  Built:            Sun Feb 10 04:13:06 2019
  OS/Arch:          linux/amd64
  Experimental:     false

Upvotes: 0

Views: 174

Answers (2)

ksl
ksl

Reputation: 4719

It seems that somehow a non-space character got in between run and --name. I copied the string from a web page.

The above command does in fact work ok.

Upvotes: 0

milanbalazs
milanbalazs

Reputation: 5329

You need to stop the running container before you change the port. You can see a quite similar post: Docker doesn't recognize the -p command all of a sudden

Upvotes: 1

Related Questions