Home Docker
Post
Cancel

Docker

Docker is an open-source platform that allows you to automate the deployment, scaling, and management of applications by packaging them into lightweight, portable containers.

How to install docker and docker-compose on Linux:

Update apt:

1
sudo apt update && upgrade -y

Only Docker

Install docker.io:

1
sudo apt install docker.io -y

Test docker:

1
sudo docker run --name web -itd -p 8080:80 nginx

Alternative

Install docker.io with docker-compose:

1
sudo apt install docker.io docker-compose -y

Test docker-compose

Create a folder:

1
mkdir docker-test && cd docker-test

Create and edit a docker-compose.yaml file:

1
nano docker-compose.yaml

Add this to the yaml file:

1
2
3
4
5
6
7
version: "3"
services:
  website:
    image: nginx
    ports:
      - "8081:80"
    restart: always

Run docker compose from folder:

1
sudo docker-compose up -d

Check if docker container is running:

1
sudo docker ps

Or for only docker compose containers:

1
sudo docker-compose ps
This post is licensed under CC BY 4.0 by the author.