Expose Multiple Docker Ports

I was working with containers recently with Jenkins. I didn’t want the server process running on my machine all the time, but I did need to allow some communication. Jenkins uses 8080 by default, but agents need another port.

I figured there was a way to do this, and I found it on Stack Overflow, which is the perfect forum for a question like this. The answer? Multiple –p parameters.

Instead of

docker run –-name jenkinsci –p 8080:8080 jenkins/blueo

I do this:

docker run –-name jenkinsci –p 8080:8080 -p 50000:50000 jenkins/blueo

That opens two ports from the host to the container, which is what I need.

About way0utwest

Editor, SQLServerCentral
This entry was posted in Blog and tagged , . Bookmark the permalink.

1 Response to Expose Multiple Docker Ports

  1. Pingback: Exposing Multiple Docker Ports – Curated SQL

Comments are closed.