Skip to content

Expose Kitura's Port in Docker Container to Host Machine

rolivieri edited this page Mar 15, 2016 · 5 revisions

These are the steps to expose Kitura's port in a Docker container to the host (e.g. an OS X laptop):

  1. Execute docker run -d -P ibmcom/kitura-ubuntu:latest.

  2. Execute docker ps.

  3. Inspect the values under the PORTS column for the container you just started. You should see something like the following: 0.0.0.0:32768->8090/tcp. This means that Kitura’s port 8090 in the Docker container is mapped to port 32768 on the host. Now, the host in this case is not the OS X laptop. Instead, it is the Virtual Box machine that Docker uses.

  4. Go to Virtual Box, and open the settings for the virtual machine that is running Docker (i.e. right click on the virtual machine and select Settings).

  5. Go to the Network tab and click on Port Forwarding.

  6. Add a new row with the following values:

  • name: kitura
  • protocol: tcp
  • host ip: 127.0.0.1
  • host port: 8090
  • guest port: <the host port reported under the PORTS column (e.g. 32768)>
  1. Click OK and OK again to save the settings for the virtual machine.

  2. Open your browser and go to: http://localhost:8090 and you should see the Kitura welcome page.