# How to: Docker

# What is Docker?

##### <span style="color: rgb(0, 0, 0);">**Introduction**</span>

<span style="color: rgb(0, 0, 0);">Docker is a platform that allows you to easily package, deploy, and run applications in a lightweight, portable, and consistent way. It uses a technology called containers to isolate applications and their dependencies (such as libraries and other software they need) from the host system, making it easier to run the application anywhere, on any machine. ლ(ಠ\_ಠ ლ)</span>

##### <span style="color: rgb(0, 0, 0);">**Capabilities of Docker**</span>

- <span style="color: rgb(0, 0, 0);">**Containers**: Think of containers as small, lightweight "boxes" that hold everything an application needs to run—like the application code, system libraries, and configurations—so it can run anywhere without problems. A container is isolated, meaning it doesn’t interfere with other applications on the same system.</span>
- <span style="color: rgb(0, 0, 0);">**Portability**: Once you package an application in a Docker container, you can move it across different environments (like your local computer, a developer's laptop, or a server in a data center). As long as Docker is installed, the application will run the same way, no matter where it is.</span>
- <span style="color: rgb(0, 0, 0);">**Consistency**: Docker ensures that the application behaves the same way in every environment. It eliminates the problem of “it works on my machine,” where an app runs perfectly on one computer but not on another because of differences in setup or installed software.</span>
- <span style="color: rgb(0, 0, 0);">**Efficient Use of Resources**: Containers are lightweight compared to traditional virtual machines because they share the same operating system kernel. This makes them faster to start and use fewer resources, making them more efficient for running multiple applications.</span>
- <span style="color: rgb(0, 0, 0);">**Easy Deployment**: With Docker, you can define all the settings, libraries, and services an application needs in a file called a Dockerfile. This file can be shared with others or used to automatically build containers in any environment.</span>

<span style="color: rgb(0, 0, 0);">*Last Updated: 2/19/2025  
BY: Lilian*</span>

# 1.0 Installation and Swarm Initialization

---

##### <span style="color: rgb(0, 0, 0);">**Materials / Pre-Setup**</span>

1. <span style="color: rgb(0, 0, 0);">Create new Ubuntu Server VM on the Proxmox server (Refer to <span style="color: rgb(22, 145, 121);">[Create a VM](https://wiki.raspberrypiclub.org/books/how-to-proxmox/page/30-create-a-vm) </span>in How to: Proxmox)</span>

---

*\*\*TO BE ADDED*

# 2.0 Adding Users to Docker Group

---

<span style="color: rgb(0, 0, 0);">*\*Must be done on each docker node if there's more than one*</span>

<p class="callout info"><span style="color: rgb(45, 194, 107);">**<span style="color: rgb(35, 111, 161);">\*Any confusion on command syntax/structure can be clarified in </span><span style="color: rgb(22, 145, 121);">[Legend](https://wiki.raspberrypiclub.org/books/how-to-refer-to-the-documentation/page/legend)</span>** </span></p>

<div align="left" dir="ltr" id="bkmrk-docker-swarm-nodes-i"></div>1. <span style="color: rgb(0, 0, 0);">Login to the docker node</span>

2. <span style="color: rgb(0, 0, 0);">Add the user</span>

<p class="callout info"><span style="color: rgb(35, 111, 161);">**\*Set the password to something easy i.e. password // can also be changed using the 'passwd' command**</span></p>

```
sudo adduser [USER]
```

3. <span style="color: rgb(0, 0, 0);">Give user permission to the docker and sudoers group</span>

```
sudo usermod -aG docker [USER]
sudo usermod -aG sudo [USER]
```

4. <span style="color: rgb(0, 0, 0);">Connect to user’s account and import user’s Github keys</span>

```
su [USER]
ssh-import-id-gh [GITHUB USERNAME]
```

5. <span style="color: rgb(0, 0, 0);">Test whether or not the user can connect to each docker swarm:</span>

```bash
ssh [USER]@[IP ADDRESS]
```

6. <span style="color: rgb(0, 0, 0);">Have user change their password NOT ON ROOT on each docker node created:</span>

```
passwd 
```

<span style="color: rgb(0, 0, 0);">*Last Updated: 2/22/2025* </span><span style="color: rgb(0, 0, 0);">*Contributors: Lilian, Vivian*</span>