Install Baby Buddy Inside Docker Container in Linux

Install Baby Buddy Inside Docker Container in Linux

Baby Buddy is a web-based application that can be used for caregivers to track babies sleep, feedings, diaper changes, tummy time, and more.

This tutorial explains how to install Baby Buddy inside a Docker container in the Linux. Commands have been tested on Ubuntu.

Prepare environment

Make sure you have installed Docker in your system. If you are using Ubuntu, installation instructions can be found in the post.

You also need to have a running MySQL container. Instructions can be found in the post.

Install Baby Buddy

Before starting, create babybuddy database:

docker exec -it mysql mysql -u root -p -e "CREATE DATABASE babybuddy"
  • Host network

Run the following command to create a container for Baby Buddy that uses host network:

docker run -d --name=babybuddy --restart=always --network=host \
    -v /opt/babybuddy/config:/config \
    -e DB_ENGINE=django.db.backends.mysql \
    -e DB_USER=root \
    -e DB_PASSWORD=pwd123 \
    -e DB_NAME=babybuddy \
    -e DB_PORT=3306 \
    -e DB_HOST=127.0.0.1 \
    linuxserver/babybuddy

MySQL container should run on host network as well.

  • User-defined bridge network

User-defined bridge network can be used for listening on different port. By default, Baby Buddy service is listening on port 8000. It can be changed with -p option.

docker network create app-net
docker run -d --name=babybuddy --restart=always --network=app-net \
    -p 8080:8000 \
    -v /opt/babybuddy/config:/config \
    -e DB_ENGINE=django.db.backends.mysql \
    -e DB_USER=root \
    -e DB_PASSWORD=pwd123 \
    -e DB_NAME=babybuddy \
    -e DB_PORT=3306 \
    -e DB_HOST=mysql \
    linuxserver/babybuddy

MySQL container should run on the same user-defined bridge network as well.

Notes:

  • It might take a while before initialization is finished and the Docker container starts to respond to requests.
  • The DB_USER and DB_PASSWORD can be used to specify MySQL credentials.
  • When user-defined bridge network is used, don't forget to change DB_HOST. It specifies MySQL container name.

Testing Baby Buddy

Open a web browser and go to http://<IP_ADDRESS>:8000, where <IP_ADDRESS> is the IP address of the system. Log in to the dashboard with the default username (admin) and password (admin).

Baby Buddy Inside Docker Container in Linux

Uninstall Baby Buddy

To completely remove Baby Buddy, remove its container:

docker rm --force babybuddy

Remove Baby Buddy image:

docker rmi linuxserver/babybuddy

You can also remove Baby Buddy data:

sudo rm -rf /opt/babybuddy

If a user-defined bridge network was created, you can delete it as follows:

docker network rm app-net

Leave a Comment

Cancel reply

Your email address will not be published.