How do I run a docker instance from a DockerFile?

Michael Joseph Aubry picture Michael Joseph Aubry · Mar 18, 2016 · Viewed 121.5k times · Source

I finally figured out how to get docker up and running.

docker run --name my-forum-nodebb --link my-forum-redis:redis -p 80:80 -p 443:443 -p 4567:4567 -P -t -i nodebb/docker:ubuntu

I linked it to a redis instance, cool.

This is from scratch and I assume that when I created the redis instance

docker run --name my-forum-redis -d -p 6379:6379 nodebb/docker:ubuntu-redis

it pulls the image from a remote repo?

NodeBB offers a Dockerfile https://github.com/NodeBB/NodeBB/blob/master/Dockerfile I am not really quite sure how to use it. I am assuming that I can somehow create a local environment by calling this Dockerfile on my remote.

Is this correct? If so how can I create the local instance pointing to the remote?

Answer

Andreas Wederbrand picture Andreas Wederbrand · Mar 18, 2016

Download the file and from the same directory run docker build -t nodebb .

This will give you an image on your local machine that's named nodebb that you can launch an container from with docker run -d nodebb (you can change nodebb to your own name).