March 20th

Docker NuxtJS tutorial. Dockerize NuxtJS app in 3 minutes.

This quickstart guide provides a basic introduction to the NuxtJS progressive framework running on docker. This is a great starting point if you are brand new to the NuxtJS framework or if you want to have your docker app.


Before you start, you need to have some certain prerequisites in place:

  • NPM > 5.2.0
  • Local machine running the latest version of Docker.

Get Started

Let's create a NuxtJS project and then see how we can dockerize it using Docker.

Step 1 - Create a NuxtJS Project

Nuxt.js is really easy to get started with. A simple project only needs the nuxt dependency. To get started quickly, the Nuxt.js team has created scaffolding tool create-nuxt-app that you will use. Make sure you have npx installed (npx is shipped by default since NPM 5.2.0)

So just runs:

$ npx create-nuxt-app nuxtjs-tutorial

Or with yarn:

$ yarn create nuxt-app nuxtjs-tutorial

It will ask you some questions:

header image

Once answered it will install all the dependencies so the next step is to navigate to the project folder and launch it with:

$ cd nuxtjs-tutorial
$ npm run dev

header image

header image

You will see your server running on: This screen will changes according what tools did you select.

Congratulations, you’ve created a NuxtJS project!

Note: For more extensive instructions about NuxtJS, refer to the NuxtJS documentation.

Step 3 - Dockerize the Project

Setup Docker

Before creating a container for the NuxtJS application and shipping it off, you need to install Docker on your local machine. For learning purpose, you will install Docker Community Edition. Select your OS from the list below and follow the setup instructions:

Make the docker App image

The next stage to improve your docker php development workflow is adding a Dockerfile to your project. The structure of a Dockerfile can be considered a series of instructions on how to build your container/image.

Start the Dockerfile by creating an empty file named Dockerfile in the root of your project. Then, complete each instruction according to the following example:

# Dockerfile
FROM node:11.13.0-alpine

# create destination directory
RUN mkdir -p /usr/src/nuxt-app
WORKDIR /usr/src/nuxt-app

# update and install dependency
RUN apk update && apk upgrade
RUN apk add git

# copy the app, note .dockerignore
COPY . /usr/src/nuxt-app/
RUN npm install
RUN npm run build



CMD [ "npm", "start" ]

Building and Running the Container

Building the container is very straight forward once you have Docker and Docker Machine on your system. The following command will look for your Dockerfile and download all the necessary layers required to get your container image running. Afterwards, it will run the instructions in the Dockerfile and leave you with a container that is ready to start.

To build your php laravel docker container, you will use the docker build command and provide a tag or a name for the container, so you can reference it later when you want to run it. The final part of the command tells Docker which directory to build from.

$ cd
$ docker build -t nuxtjs-tutorial .

The final step is to run the container you have just built using Docker:

$ docker run -it -p 3000:3000 nuxtjs-tutorial

The command tells Docker to run the container and forward the exposed port 3000 to port 3000 on your local machine. After you run this command, you should be able to visit http://localhost:3000 in your browser.

You can see the Docker containers that are currently running on your system (along with their Container IDs) with:

$ docker ps -a

To turn off your Docker container, run:

$ docker stop container_id

Push to cloud

1. Create your app

In order to install your docker NuxtJS example, just create a new app via cli or admin panel and set a port to 3000.

header image

2. Push your docker container

header image

3. Set up resources

header image

4. Logs and app status

header image

5. Release your app

After to click on the release button, your php docker tutorial will be deployed, Just click on the generated URL and you will get your app running.

header image header image

Now you can deploy your NuxtJS app without a massive build time.

Bonus 1: SSL certificate for HTTPS

It's already done for you. If you need to connect your custom domain, SSL certificate will be provided for it.

Bonus 2: Autoscaling

With autoscaling the app will be scaled up when CPU and RAM load goes up and scaled down when it goes down.

Now you can deploy your NuxtJS app without a massive build time.

Dockerize your Job

Just for $2/month
Share this article:

Ask a question

Please type your name.
Please provide your email address.
Please tell us a bit more

More great guides

Docker nodejs express tutorial

Docker NodeJS Express guide

Simple Nodejs Socket guide for docker deploy. Use it for comfort start with us.

Read Guide
Docker python django tutorial

Docker Python Django tutorial

This is a brief tutorial that presents how you can run a simple 'Hello World'-style web application written in Django in docker.

Read Guide
Docker PHP laravel tutorial

Docker PHP laravel tutorial

This quickstart guide provides a basic introduction to the Laravel framework running on docker. This is a great starting point if you are brand new to the Laravel framework or if you want to have your docker PHP app.

Read Guide
7 times faster deployment
Dockerize automaticaly completes deployment after receiving your Docker image
50% of AWS price
We don’t have any hidden prices and will never ask you to pay extra fee for our services
Open Sidebar Close Sidebar