Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Error "Docker: invalid publish opts format " runing Graphviz docker container on Mac Os

I'm completely new to docker and am using it for the first time.

I have installed Docker Desktop for Mac OS and run the 'Hello-world' container successfully. I am now trying to run this 'omerio/graphviz-server' from https://hub.docker.com/r/omerio/graphviz-server (which is what I really want Docker for) and although the 'docker pull omerio/graphviz-server' command completes successfully:

devops$ docker pull omerio/graphviz-server
Using default tag: latest
latest: Pulling from omerio/graphviz-server
863735b9fd15: Pull complete 
4fbaa2f403df: Pull complete 
44be94a95984: Pull complete 
a3ed95caeb02: Pull complete 
ae092b5d3a08: Pull complete 
d0edb8269c6a: Pull complete 
Digest: sha256:02cd3e2355526a927e951a0e24d63231a79b192d4716e82999ff80e0893c4adc
Status: Downloaded newer image for omerio/graphviz-server:latest

the command to start the container (given on https://hub.docker.com/r/omerio/graphviz-server): 'docker run -d -p : omerio/graphviz-server' gives me the error message:

devops$ docker run -d -p : omerio/graphviz-server
docker: invalid publish opts format (should be name=value but got ':').
See 'docker run --help'.

Searching for this error message returns no information at all. I see that the container in question was last updated over 3 years ago - could it be an old format that Docker no longer supports?

like image 335
Steve Ives Avatar asked Oct 17 '22 05:10

Steve Ives


1 Answers

-p option of docker run command binds ports between host and container (see docs), and its usage is most of the time the following :

docker run <other options> \
    -p <port on the host>:<port in the container> \
    <my_image> <args>

As for your example : it seems that running the image needs an argument (the port in the container). Let's choose 8080 for example (that means port 8080 will be used by the application inside the container).

If you want to access it directly on your host (via localhost), you should bind 8080 port (in the container, the port we chose previously) to any available port on your host (let's say 8081), like this :

docker run \
    -p 8081:8080 \
    omerio/graphviz-server 8080

You should now be able to access the application (port 8080 of the application running in the container) from your host via localhost:8081.

like image 130
norbjd Avatar answered Oct 19 '22 02:10

norbjd