Flask Dashboard Black - How to use it with Docker (VIDEO)

Hello Coders,

Thanks for reading this post. The article presents how to use a free admin dashboard provided by the AppSeed plaform using Docker, the well-known virtualization software. The application used as a sample Flask Dashboard Black can be accessed, without an account directly from Github.  

In a rush? Check out the video that explains how to use Flask Dashboard Black inside a Docker image. Thank You!
Flask Dashboard Black - How to use it in Docker

How to use it in Docker

  1. Grab the code from the public repository
$ git clone https://github.com/app-generator/flask-black-dashboard.git
$ cd flask-black-dashboard

2. Pull the necessary Docker images used by the container

$ sudo docker-compose pull
Pulling appseed-app ... done
Pulling nginx       ... done

Basically Nginx images and the app image. Nothing fancy, we are trying to keep things simple and beginners friendly.

3. Setup the app inside the container

$ sudo docker-compose build

Basically this step will copy the sources and configuration inside the container. There are simple steps automatized by Dockerfile  - the output should look like this:

nginx uses an image, skipping
Building appseed-app
Step 1/8 : FROM python:3.6
 ---> 1daf62e8cab5
Step 2/8 : ENV FLASK_APP run.py
 ---> Using cache
 ---> 7595f3a3abb7
Step 3/8 : COPY run.py gunicorn-cfg.py requirements.txt config.py .env ./
 ---> Using cache
 ---> 8c166c8b067a
Step 4/8 : COPY app app
 ---> Using cache
 ---> 74eda037dd5b
Step 5/8 : COPY migrations migrations
 ---> Using cache
 ---> 0e30dc7aacd1
Step 6/8 : RUN pip install -r requirements.txt
 ---> Using cache
 ---> 4aa46a7fdc76
Step 7/8 : EXPOSE 5005
 ---> Using cache
 ---> 76946525d13a
Step 8/8 : CMD ["gunicorn", "--config", "gunicorn-cfg.py", "run:app"]
 ---> Using cache
 ---> 8c91222425bf
Successfully built 8c91222425bf
Successfully tagged flask-black-dashboard_appseed-app:latest

4. Start the container with our flask dashboard inside

$ sudo docker-compose up

We can start the container in deamon mode using `-d` argument, with the container executed in the background and the console released for other commands.

$ sudo docker-compose up -d 

At this point, the app should be available in browser: http://localhost:5005. Please register a new user (no default user is provided) and authenticate.

For support, please access the official support page or talk directly with us on Discord. Thank you!  

What is Docker

Docker is a tool designed to make it easier to create, deploy, and run applications by using containers. Containers allow a developer to package up an application with all of the parts it needs, such as libraries and other dependencies, and deploy it as one package. By doing so, thanks to the container, the developer can rest assured that the application will run on any other Linux machine regardless of any customized settings that machine might have that could differ from the machine used for writing and testing the code - definition provided by OpenSource.com

Show Comments

Get the latest posts delivered right to your inbox.