Logo

Docker Basics Guide

This guide provides a quick reference for getting started with Docker on Ubuntu. Docker is a platform for developing, shipping, and running applications in containers.

Table of Contents

  1. Installing Docker
  2. Running Your First Container
  3. Building Docker Images
  4. Dockerfile Basics
  5. Managing Docker Containers
  6. Networking with Docker
  7. Data Management with Docker Volumes
  8. Docker Compose
  9. Docker Hub and Registry
  10. Docker Cleanup

1. Installing Docker

Install Docker on Ubuntu:


sudo apt update
sudo apt install docker.io
sudo usermod -aG docker $USER

Logout and login to apply group changes.

2. Running Your First Container

Run a simple hello-world container to test the installation:


docker run hello-world

3. Building Docker Images

Create a Dockerfile and build a custom image:


# Dockerfile
FROM ubuntu:latest
RUN apt update && apt install -y nginx
CMD ["nginx", "-g", "daemon off;"]

Build the image:


docker build -t my-nginx-image .

4. Dockerfile Basics

5. Managing Docker Containers

6. Networking with Docker

7. Data Management with Docker Volumes

8. Docker Compose

Create a docker-compose.yml file for multi-container applications:


version: '3'
services:
  web:
    image: nginx:latest
  db:
    image: postgres:latest

Run the services:


docker-compose up

9. Docker Hub and Registry

10. Docker Cleanup


Go back to Docker Guide.

Visit other Developer Guides.