Bootstrap FreeKB - Sails - Create a Sails image on Docker using a Dockerfile
Sails - Create a Sails image on Docker using a Dockerfile

Updated:   |  Sails articles

Before you can install Sails on Docker, you will need to install Docker and install NodeJS.

Create a file named Dockerfile.

touch /usr/local/docker/sails/Dockerfile

 

Append the following to Dockerfile. This will create an image using the latest version of Sails.

FROM node:latest
RUN npm install sails --global
EXPOSE 1337

 

Or you could specify a version of Sails.

FROM node:latest
RUN npm install sails@1.4.3 --global
EXPOSE 1337

 

The docker build command can be used to build the image. In this example, /usr/local/docker/sails is the directory that contains the Dockerfile.

docker build --tag sails:latest /usr/local/docker/sails

 

A Docker image contains the code used to create a Docker container, such as creating a Nginx web server, or a mySQL server, or a home grown app, and the list goes on. In this way, an image is like a template used to create a container. An image is kind of like a virtual machine, but much more light weight, using significantly less storage a memory (containers are usually megabytes in size).

 

If the install is successful, something like this should be returned.

Successfully built fb60d5e3e7c8
Successfully tagged sails:latest

 

And the docker images command should return something like this.

~]# docker images
REPOSITORY    TAG     IMAGE ID      CREATED             SIZE
nodejs/sails  latest  fb60d5e3e7c8  About a minute ago  973MB
node          latest  7528ad312b56  About a minute ago  944MB

 




Did you find this article helpful?

If so, consider buying me a coffee over at Buy Me A Coffee



Comments


Add a Comment


Please enter 7f4ca8 in the box below so that we can be sure you are a human.