Defining Our First Custom Image
Learn how to use Dockerfile to build your own Rails image.
We'll cover the following
Build image
The process of generating an image from a Dockerfile is called building an image. We do that with the docker build
command, which has the following format:
$ docker build [options] path/to/build/directory
If we are in the directory containing our Dockerfile and project file, we can use the following command:
$ docker build .
To name the image, we use -t
option:
docker build -t [image_name] .
We will use the following command to build an image. You can see how it works by clicking the Run button.
docker build -t railsapp .
Try to press the Run button periodically as the terminal can get disconnected.
Get hands-on with 1400+ tech skills courses.