dockerdocker-machine

How do I run a docker instance from a DockerFile?


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?


Solution

  • Download Dockerfile and Build a Docker Image

    Download the Dockerfile to a directory on your machine, and from that same directory, run the following docker build command. Make sure to replace image_name with what you would like to name your image. Docker image naming restrictions can be found here.

    docker build --tag 'image_name' .
    

    This will give you an image on your local machine that you can create a container from. To do so, you'll need to run the following docker run command. Make sure to replace image_name with what you named your image in the previous command.

    docker run --detach 'image_name'