TiagoSansao / docker-example

Example of a node express application dockerized using Ubuntu image

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Docker Example


Requirements

First, you need to install Docker in your system.

Explaining the files

In the Dockerfile there are instructions that will be executed to generate the image during the build.
In the .dockerignore there are files that won't be included in the image when doing the build.
In the docker.compose-yml you can specify flags that you would need to add manually for each service when running an image, then start it all together with one single command.

Instructions

If you create your own Dockerfile you will always have to start from another image, in this case we are using the Ubuntu image as you can see in the Dockerfile. When you build the Dockerfile it will automatically install the image for you in your system, but you can always download images from dockerhub from your terminal using:

docker pull <image-name>:<version>
# If version isn't specified, it will pull the latest one.

After you have your Dockerfile finished, you need to build and manage your image:

# Go to the directory that the .Dockerfile is in and type:
$ docker build . -t <image-name>

# After building one image, you can see all your images typing:
$ docker images

# In order to start one without using the docker-compose type:
$ docker run <image-name>

# To see the active containers use:
$ docker ps

# To close a container get the Id from docker ps and type:
$ docker container stop <container-id>

# If you have a docker compose you can either start one service using:
$ docker-compose run <service>
# or start all services using:
$ docker-compose start

For more information access the documentation.

About

Example of a node express application dockerized using Ubuntu image


Languages

Language:HTML 36.2%Language:JavaScript 33.5%Language:Dockerfile 30.3%