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

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.