How to install LabCollector using Docker? - LabCollector

Search Knowledge Base by Keyword

You are here:
← All Topics
The following knowledge base will show you how you can install LabCollector using Docker.

Docker is a software platform that allows you to build, test, and deploy applications quickly. Docker packages software into standardized units called containers that have everything the software needs to run including libraries, system tools, code, and runtime.

Using Docker, you can quickly deploy and scale applications into any environment and know your code will run.

SUMMARY:

1. Introduction to Docker

  • 1a. What is Docker?
  • 1b. Why use Docker?
  • 1c. Installing Docker

2. Installing LabCollector using Docker

  • 2a. How can I install LC using Docker?
  • 2b. Container shell access and viewing LabCollector logs

1. Introduction to Docker

  • 1a. What is Docker?

Docker is a containerization technology that enables developers to package applications and their dependencies into a single unit called a container. Containers are isolated from the host operating system, which makes them lightweight, portable, and easy to deploy. Docker is an open-source tool that can be used to run and manage containers.

 

  • 1b. Why use Docker?

Using Docker to install and run LabCollector has several advantages:

1. Portability: Docker containers can run on any system that supports Docker, which means that the same containerized application can run on any platform without any modifications.

2. Consistency: Docker containers are isolated from the host operating system, which ensures that the application runs consistently regardless of the environment it’s deployed in.

3. Scalability: Docker makes it easy to scale up or down the number of instances of an application running in a container, which makes it ideal for applications that require high availability.

4. Easy Installation: Docker simplifies the installation process by eliminating the need to install dependencies and configure the application manually.

 

  • 1c. Installing Docker

Before we can install LabCollector using Docker, we need to install Docker on our system. Here are the steps to install Docker on Ubuntu Linux:

1. Update the package index and install the dependencies:

sudo apt-get update
sudo apt-get install apt-transport-https ca-certificates curl gnupg-agent software-properties-common

Tips/Hints
You are required to use sudo to run Docker commands, since the docker user group exists but contains no users.
.

2. Add Docker’s GPG key:

curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add –

3. Add the Docker repository:

sudo add-apt-repository “deb [arch=amd64] https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable”

4. Update the package index and install Docker:

sudo apt-get update
sudo apt-get install docker-ce docker-ce-cli containerd.io

5. Verify that Docker is installed correctly:

sudo service docker start

sudo docker run hello-world

Note
If Docker is installed correctly, you should see a message saying “Hello from Docker!”.

2. Installing LabCollector using Docker

Note
Please take a moment to explore our Docker image and documentation, conveniently accessible on Docker hub.
.
  • 2a. How can I install LC using Docker?

Once Docker is installed, we can proceed with installing LabCollector using Docker. Here are the steps:

First of all, you need to know how you can use the LabCollector’s image:

$ docker run –name some-labcollector –network some-network -d agilebio/labcollector:v6-latest

If you’d like to be able to access the instance from the host without the container’s IP, standard port mappings can be used:

$ docker run –name some-labcollector -p 8080:80 -d agilebio/labcollector:v6-latest

Then, access it via http://localhost:8080 or http://host-ip:8080 in a browser.

… via docker-compose or docker stack deploy

Example docker-compose.yml for labcollector:

version: "2.0"
services:
  labcollector:
    ports:
      - "8080:80"
    image: agilebio/labcollector:v6-latest
    volumes:
      - documents:/var/www/html/documents
      - maps:/var/www/html/maps
      - files:/var/www/html/files
      - extra_modules:/var/www/html/extra_modules
      - backup:/var/www/html/backup
      - images:/var/www/html/netplasmid/images
      - UserFiles:/var/www/html/UserFiles
      - cron:/var/spool/cron
    networks:
      - labcollector-backend
  mariadb:
    image: mariadb:10.6.10
    ports:
      - "3308:3306"
    restart: always
    environment:
      MARIADB_ROOT_PASSWORD: A_SECURE_PASSWORD
    volumes:
      - mysql:/var/lib/mysql
    networks:
      - labcollector-backend
networks:
  labcollector-backend: {}
volumes:
  documents:
  maps:
  files:
  extra_modules:
  backup:
  images:
  UserFiles:
  mysql:
  cron:

Run docker stack deploy -c stack.yml labcollector (or docker-compose -f stack.yml up), wait for it to initialize completely, and visit http://swarm-ip:8080, http://localhost:8080, or http://host-ip:8080 (as appropriate).

    • Adding additional libraries / extensions

This image comes with pre-installed PHP extensions for working with LabCollector. If you need additional PHP extensions, you’ll need to create your own image FROM this one. The documentation of the php image explains how to compile additional extensions.

    • Running as an arbitrary user

See the “Running as an arbitrary user” section of the php image documentation

When running this image, it is important to note that they’re based on PHP-Apache image (Debian OS), and have a default USER of Debian’s www-data, whose UID is 1000, so when running labcollector:v6-latest –user 1000:1000 is likely going to be necessary.

 

Here’s an example of what the output might look like:

“` 
CONTAINER ID                IMAGE                                COMMAND                CREATED            STATUS                    PORTS                    NAMES
f8a56e7c0255  agilebio/labcollector:php5-7  “apache2-foreground”  2 minutes ago   Up 2 minutes   0.0.0.0:8080->80/tcp   labcollector
“`

Congratulations, you have now successfully installed LabCollector using Docker! From now on, you can easily manage your LabCollector installation using Docker commands, such as starting, stopping, and updating the container.

Tips/Hints
The labcollector images will come in many flavors, each designed for a specific use case. For now, the v6-latest comes with PHP and Apache

 

  • 2b. Container shell access and viewing LabCollector logs

Once you have LabCollector running inside a Docker container, you may need to access the container’s shell to perform certain tasks or view the application’s logs for troubleshooting purposes. Docker provides commands to achieve both of these tasks.

Container Shell Access: To access the shell of a LabCollector container, you can use the `docker exec` command. It allows you to run commands inside a running container. Here’s an example:

$ docker exec -it some-labcollector bash

Let’s break down the above command:

– `docker exec`: This is the Docker command used to execute a command inside a running container.
– `-it`: These flags allow you to interact with the container’s shell by allocating a pseudo-TTY and keeping the session open for input.
– `some-labcollector`: This is the name or ID of your LabCollector container. Replace it with the appropriate name or ID.

After running the command, you’ll be inside the LabCollector container’s shell, where you can execute commands and perform tasks as needed. This can be useful for tasks such as checking the container’s file system, inspecting configurations, or troubleshooting.

Viewing LabCollector Logs: LabCollector generates logs that can be helpful for diagnosing issues or monitoring the application’s behavior. Docker provides an easy way to view the logs of a running container using the `docker logs` command. Here’s an example:

$ docker logs some-labcollector

This command displays the logs generated by the LabCollector container. Replace `some-labcollector` with the actual name or ID of your container.

The logs can provide valuable information about the application’s activities, warnings, errors, and other relevant details. You can use this information to troubleshoot issues, monitor performance, or gain insights into the behavior of LabCollector.

Related topics: