Summary

Overview

This course session provides a hands-on, step-by-step guide to setting up a Docker-based environment for deploying XWiki, a wiki platform. The trainer walks participants through installing Docker, configuring system permissions, creating a custom Docker network, pulling and running MySQL and XWiki containers, and resolving common execution issues such as permission errors, port conflicts, and command formatting. The session emphasizes practical command-line execution, troubleshooting, and collaborative problem-solving in a shared virtual environment.

Topic (Timeline)

1. Environment Setup and Docker Installation [00:00:04 - 00:08:15]

  • Trainer confirms participants have updated their system repositories and are ready to install required software.
  • Identifies absence of Docker on the trainer’s system and initiates installation process.
  • Demonstrates key Docker installation commands: sudo apt update, adding Docker’s official GPG key, and adding the Docker repository.
  • Emphasizes correct command syntax: commands must be entered as single lines without unintended line breaks or spaces.
  • Guides participants through pasting commands into a text editor (e.g., Notepad) to avoid formatting errors before execution.
  • Addresses common errors: “permission denied,” “no such file or directory,” and clipboard issues in remote sessions.
  • Reinforces use of Ctrl+Shift+V for pasting in terminal and avoiding mouse navigation during command entry.

2. Docker Installation Verification and Permission Fixing [00:08:15 - 00:19:03]

  • Verifies successful Docker installation by running docker version and docker info.
  • Resolves “permission denied” errors by modifying socket file permissions using sudo chmod 777 /var/run/docker.sock.
  • Explains the role of the Docker socket and why elevated permissions are required for non-root users.
  • Confirms participants can execute Docker commands without sudo by adjusting file access rights.
  • Encourages participants to validate their setup by running docker info and ensuring full output is displayed.

3. Docker Service and User Configuration [00:19:03 - 00:21:30]

  • Instructs participants to check Docker service status using systemctl status docker.
  • Teaches how to exit the status output by pressing Q.
  • Confirms Docker is active and running across all participants’ systems.
  • Guides users to report completion via chat and confirms successful service status for all attendees.

4. Creating a Docker Network for XWiki Deployment [00:21:30 - 00:32:29]

  • Introduces the concept of Docker networks for container isolation and communication.
  • Demonstrates creation of a custom bridge network using docker network create xwiki-network.
  • Teaches verification using docker network ls to list existing networks.
  • Reinforces the structure of Docker commands: main command (docker) + subcommand (network create).
  • Instructs participants to create their own network and verify its presence in the list.
  • Notes that only a few participants completed this step; encourages peer support and screen sharing for troubleshooting.

5. Pulling and Running MySQL Container [00:32:29 - 00:48:24]

  • Explains the two-step process for containers: docker pull followed by docker run.
  • Demonstrates pulling MySQL 5.7 image: docker pull mysql:5.7.
  • Verifies image availability using docker images.
  • Introduces docker ps -a to list all containers (running and stopped).
  • Addresses port conflicts in shared environments by demonstrating port binding: -p <host-port>:3306.
  • Guides participants to assign unique host ports (e.g., 3307, 3311) to avoid collisions.
  • Emphasizes correct syntax: space after backslash (\) for multi-line commands, and correct container naming.
  • Shows how to use up-arrow to recall and edit previous commands to fix formatting errors.
  • Encourages participants to declare their chosen port numbers in chat to prevent conflicts.

6. Running XWiki Container and Preparing for Next Phase [00:48:24 - 00:51:28]

  • Notes that XWiki container setup is pending due to time constraints and shared environment issues.
  • Identifies a participant’s error: missing space after xwiki-network:latest in the docker run command.
  • Demonstrates correcting the command using arrow keys and re-execution.
  • Confirms successful container creation and visibility via docker ps.
  • Mentions the need for a second container (XWiki) to connect to the MySQL container via the custom network.

7. Break Announcement and Session Pause [00:51:28 - 00:53:28]

  • Announces a planned 1-hour lunch break after a 15-minute break (which is skipped).
  • Confirms reconvening time: one hour later.
  • Ends session with a clear transition to break, indicating the next phase will resume after lunch.

Appendix

Key Commands

  • sudo apt update
  • curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo gpg --dearmor -o /usr/share/keyrings/docker-archive-keyring.gpg
  • echo "deb [arch=amd64 signed-by=/usr/share/keyrings/docker-archive-keyring.gpg] https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable" | sudo tee /etc/apt/sources.list.d/docker.list > /dev/null
  • sudo apt install docker-ce docker-ce-cli containerd.io
  • sudo chmod 777 /var/run/docker.sock
  • docker version
  • docker info
  • systemctl status docker
  • docker network create xwiki-network
  • docker network ls
  • docker pull mysql:5.7
  • docker images
  • docker ps -a
  • docker run -d --name mysql-xwiki -p <host-port>:3306 -e MYSQL_ROOT_PASSWORD=*** -e MYSQL_DATABASE=xwiki mysql:5.7

Common Pitfalls

  • Multi-line commands with missing backslash (\) or spaces after them.
  • Using the same host port (3306) in shared environments, causing conflicts.
  • Incorrect image naming: xwiki-network:latest instead of mysql:5.7 or proper image tag.
  • Permission errors due to unmodified Docker socket permissions.
  • Pasting commands directly into terminal without verifying formatting in a text editor first.

Tools & Concepts

  • Docker: Containerization platform for isolated application environments.
  • Docker Network: Virtual network for inter-container communication.
  • Port Binding: Mapping host port to container port (-p host:container).
  • Docker Images vs Containers: Images are templates; containers are running instances.
  • CLI Tools: apt, curl, systemctl, docker, lsb_release.

Next Steps (Post-Break)

  • Pull and run the XWiki container linked to the MySQL container via the custom network.
  • Verify connectivity between XWiki and MySQL containers.
  • Access XWiki UI via browser on the assigned host port.