Skip to content

Venu005/docker-swarm-scripts

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 

Repository files navigation

Docker Learning Project

This repository contains scripts to set up a Docker learning environment using Multipass virtual machines.

Overview

This project provides an automated way to create Ubuntu virtual machines with Docker pre-installed, perfect for learning Docker concepts in an isolated environment.

Prerequisites

  • Multipass installed on your system
  • Linux operating system (tested on Ubuntu)

Files

init_instance.sh

Main script that creates and configures a new Multipass VM with Docker installed.

Usage:

./init_instance.sh <instance_name>

What it does:

  • Launches a new Ubuntu 22.04 (Jammy) VM with:
    • 1GB RAM
    • 4GB disk space
    • 2 CPU cores
  • Transfers the Docker installation script to the VM
  • Executes the Docker installation script

install-docker.sh

Docker installation script that sets up Docker CE on Ubuntu.

Features:

  • Updates system packages
  • Installs Docker CE, CLI, and related components
  • Adds user to docker group for non-root access
  • Enables Docker daemon for automatic startup
  • Installs Docker Compose plugin

Quick Start

  1. Make the scripts executable:

    chmod +x init_instance.sh install-docker.sh
  2. Create a new Docker learning environment:

    ./init_instance.sh my-docker-vm
  3. Connect to your new VM:

    multipass shell my-docker-vm
  4. Verify Docker installation:

    docker --version
    docker compose version
  5. Test Docker with a simple container:

    docker run hello-world

VM Specifications

The created virtual machine has the following specifications:

  • OS: Ubuntu 22.04 LTS (Jammy)
  • Memory: 1GB RAM
  • Storage: 4GB disk
  • CPU: 2 cores

What Gets Installed

  • Docker CE (Community Edition)
  • Docker CLI
  • containerd.io
  • Docker Buildx plugin
  • Docker Compose plugin

Managing Your Docker VM

Start/Stop VM

# Stop the VM
multipass stop my-docker-vm

# Start the VM
multipass start my-docker-vm

# Restart the VM
multipass restart my-docker-vm

Get VM Information

# List all VMs
multipass list

# Get detailed info about a specific VM
multipass info my-docker-vm

Delete VM

# Stop and delete the VM
multipass delete my-docker-vm
multipass purge

Learning Docker

Once your environment is set up, you can start learning Docker with these basic commands:

# Pull an image
docker pull nginx

# Run a container
docker run -d -p 8080:80 nginx

# List running containers
docker ps

# Stop a container
docker stop <container_id>

# Remove a container
docker rm <container_id>

Troubleshooting

Permission Issues

If you encounter permission issues with Docker commands, log out and log back in, or run:

newgrp docker

VM Not Starting

If the VM fails to start, check your system resources and ensure Multipass is properly installed:

multipass version

About

docker swarm with multispaces

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages