Skip to content

Redirect port 8080 from container to host 49160 #4

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 5 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,12 @@
# 2. Checkout source: [email protected]:gasi/docker-node-hello.git
# 3. Build container: docker build .

FROM centos:6.4
FROM centos:centos6

# Enable EPEL for Node.js
RUN rpm -Uvh http://download.fedoraproject.org/pub/epel/6/i386/epel-release-6-8.noarch.rpm
# Install Node.js and npm
RUN yum install -y npm
RUN yum install -y -q npm

# App
ADD . /src
Expand Down
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ run:
node index.js

run-container:
docker run -d gasi/centos-node-hello
docker run -p 49160:8080 -d gasi/centos-node-hello

test:
curl localhost
Expand Down
6 changes: 5 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ Node.js Hello World on CentOS using [docker][].
- Run app:

make run-container
# docker run -d gasi/centos-node-hello
# docker run -p 49160:8080 -d gasi/centos-node-hello

- Install `curl`:

Expand All @@ -52,6 +52,10 @@ Node.js Hello World on CentOS using [docker][].
# curl localhost:49163

It should print `Hello World` to the console.

If you use Boot2Docker on OS X, the port is actually mapped to the Docker host VM, and you should use the following command:

curl $(boot2docker ip):<port>

## Acknowledgements

Expand Down