Alian hub - Docker Setup Guide
Last updated
Last updated
This document provides all the steps required to set up, build, and run a Docker container for Alian hub.
Docker: Make sure Docker is installed on your machine. .
Note: If you have already configured the environment variables and set up the necessary files, you can skip this step.
Environment Variables Setup
To manage environment variables, follow the steps below to create and configure .env
files in the necessary directories. Each part of the application (root, admin, and frontend) requires a separate .env
file to store its specific environment variables.
Note: Before this Please check .env.example file in root directory.
Root Directory
Create a .env
file at the root level of the project (/.env
).
This file will contain environment variables used by the main server.
Example:
Admin Directory
Inside the admin directory, create an .env file (/admin/.env).
Use this file to specify environment variables needed by the admin portal.
Frontend Directory
Inside the frontend directory, create an .env file (/frontend/.env).
Use this file to specify environment variables needed by the frontend portal.
Run the following command to build the Docker image, loading environment variables from the .env
file:
Replace your-image-name
with your desired image name.
Once the image is built, you can start the Docker container using the following command:
This command will:
Run the container in detached mode (-d
)
Map port 4000 of the container to port 4000 on the host (-p 4000:4000
)
Name the container as specified in your-container-name
Replace your-container-name
and your-image-name
with your preferred container and image names, respectively.
To check if the container is running correctly, use the following command:
You should see your container in the list. To view logs and troubleshoot, use:
When you're done, stop and remove the container:
You can change container and image name in docker-compose.yml file.
To build image and run container:
To stop the containers:
To rebuild the image:
To check the status of the running containers:
Here's a quick summary of the key commands:
That's it! You now have a full guide for setting up, building, and running your Docker container for Alian hub.
After building your Docker image and running your container, you might want to stop and remove them. Below are the steps to do so.
To stop a running container, use the following command:
For example:
Once the container is stopped, you can remove it using the command:
For example:
If you want to stop and remove the container in one command, you can do:
To remove a Docker image after it has been built, use the following command:
For example:
If you have multiple tags or versions of an image, you might want to remove them all. You can use the -f
(force) flag to force the removal of the image even if there are existing containers associated with it.
To check which containers and images are currently available on your system, use the following commands:
List all containers (including stopped ones):
List all images:
Stop and remove the container:
Remove the Docker image: