Skip to content

Self Hosting With Docker

fingerthief edited this page May 12, 2024 · 1 revision

Using The Prebuilt Docker Image

A Prebuilt Image on DockerHub is available for those who don't want to build the image from scratch.

docker pull tannermiddleton/minimal-chat:latest

Building the Docker Image

building and deploying a Docker image for the application.

Prerequisites

  • Docker installed on your system
  • A Dockerfile which should be located in the root of the project directory already
  • A port number to run the application on (e.g. 8080)

Build Steps

To build the Docker image, navigate to the root of the project directory and run the following command:

docker build -t <image-name> .

Replace <image-name> with the desired name for your image (e.g. fingerthief/minimal-chat).

Example Command

docker build -t fingerthief/minimal-chat .

Running the Docker Container

Once the image is built, you can run the Docker container using the following command:

docker run -p e PORT=<port-number> <port-number>:<port-number> <image-name>

Replace <port-number> with the port number you want to run the application on (e.g. 8080).

Example Command

docker run -e PORT=52050 -p 52050:52050 fingerthief/minimal-chat

Accessing the Application

Once the container is running, you can access the application by navigating to http://localhost:<port-number> in your web browser.

Example

http://localhost:52050

That's it! You should now have a Docker image built and deployed for your application.

Troubleshooting

If you encounter any issues during the build or run process, you can check the Docker logs for more information:

docker logs -f <container-id>

Replace <container-id> with the ID of the running container.