# Use Containers

## Use Containers

Let us go with a `devops-first` approach:

> Our smallest experiments, no matter how trivial, will be closest to production best practices!

***Note**: Even without the video, you can learn all the crucial details from the steps that are documented below*

{% embed url="<https://youtu.be/u1CG-ujpnWk>" %}

1. Login to your [cloud-box](/docs-shoppinpal-com/1.-the-ideal-workspace/setup-a-machine-in-the-cloud/setup-box-on-digitalocean.md) over `ssh`.
   * Create it if you haven't done so already.
   * This will be a robust environment for learning.
2. To start with a clean environment, run:

   ```
   mkdir -p ~/workspace && \
   cd ~/workspace && \
   rm -rf loopback-zero-to-hero && \
   mkdir -p ~/workspace/loopback-zero-to-hero && \
   cd ~/workspace/loopback-zero-to-hero
   ```
3. [Setup your IDE](/docs-shoppinpal-com/appendix/project-sync-via-ide/sftp-with-webstorm.md#steps-are-documented-below-the-video) to work with the remote directory on the cloud-box.
   1. **Create New Project named** `loopback-zero-to-hero`
   2. **For** `Deployment Path` **use** `/root/workspace/loopback-zero-to-hero`
4. In your IDE, create a `Dockerfile` with the following content:

   ```
   # Use latest version 4.x of NodeJS
   # https://hub.docker.com/_/node/
   FROM node:4

   # install some useful tools
   RUN apt-get -y update
   RUN apt-get install -y tree
   RUN apt-get install -y vim

   # configure terminal access
   # https://github.com/dockerfile/mariadb/issues/3
   ENV TERM=xterm

   # configure envirnoment to work with tools used for tailing
   # https://github.com/jfrazelle/dockerfiles/issues/12
   ENV DEBIAN_FRONTEND=noninteractive
   RUN apt-get install -y less

   RUN mkdir -p /apps/loopback-zero-to-hero
   WORKDIR /apps/loopback-zero-to-hero
   ```
5. Create a `docker-compose.yml` file to install and run a reasonably up to date version of NodeJS:

   ```
   version: '2'
   services:
     loopback-zero-to-hero:
       build:
         context: ./
       ports:
         - "3000:3000"
       volumes:
         - ~/workspace/loopback-zero-to-hero:/apps/loopback-zero-to-hero
   ```
6. Start the service: `docker-compose up` and after it finishes running, you should see something like the following at the very end:

   ```
   WARNING: Image for service loopback-zero-to-hero was built because it did not already exist. To rebuild this image you must use `docker-compose build` or `docker-compose up --build`.
   Creating loopbackzerotohero_loopback-zero-to-hero_1
   Attaching to loopbackzerotohero_loopback-zero-to-hero_1
   loopbackzerotohero_loopback-zero-to-hero_1 exited with code 0
   ```


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://shoppinpal.gitbook.io/docs-shoppinpal-com/3.-the-backend/use-containers.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
