Project

General

Profile

Actions

Task #478

open

Task #473: Docker learning phase 1

Docker learning phase 1 [Y]

Added by Y Nguyen about 2 years ago. Updated about 2 years ago.

Status:
New
Priority:
Normal
Assignee:
-
Start date:
10/24/2023
Due date:
% Done:

100%

Estimated time:

Description

1/What is Docker?
Docker is a portable application platform used for developing, packaging, and deploying applications. It allows you to create lightweight, self-sufficient environments called "containers" to contain applications and all their dependencies. Containers can run on any operating system that supports Docker without requiring modifications to the application's source code.
2/When to use/not use Docker (pros/cons)?
When to Use Docker:
  • Application Portability
  • Microservices Architecture
  • Development and Testing
  • Continuous Integration and Continuous Deployment (CI/CD
  • Resource Efficiency
  • Scaling and Load Balancing
    When Not to Use Docker:
  • Simple Applications
  • Resource-Intensive Workloads
  • Stateful Applications
  • Tight Hardware Integration
  • Windows-Only Environments
  • Resistance to Change
    Pros of Docker:
  • Portability and Packaging
  • Environment Independence
  • Good Performance
  • Scalability
  • Large Community and Rich Ecosystem
    Cons of Docker:
  • Complexity
  • Security
  • Image Size
  • State Management
  • Resource Isolation
  • Windows Support
    3/What is Docker-compose ?
    Docker Compose is a tool for defining and running multi-container Docker applications. It allows you to define the services, networks, and volumes for your application in a single, easy-to-read file called a "docker-compose.yml" file. This file specifies how to connect multiple containers together to form a complete application stack. With Docker Compose, you can define complex application environments and launch them with a single command.
    4/Common docker/docker-compose commands
    Common docker
    1. Go live with docker run
    docker run docker/whalesay Hi

2. Manage user access with sudo vs. root
sudo usermod -G docker username

3. Retrieve images with docker pull
docker pull ubuntu:latest

4. Make a new container with docker create

5. Stop container instances with docker stop
docker stop (container ID)

6. Check container status with docker ps

7. Use a Dockerfile to create an image with docker build
docker build -t mydockertest dockerfile.

8. Control container versions with docker tag
docker tag IMAGE ID image/TAG.

Docker compose Command
1.List your images.
$ docker image ls

2.Delete a specific image.
$ docker image rm [image name]

3.Delete all existing images.
$ docker image rm $(docker images -a -q)

4.List all existing containers (running and not running).
$ docker ps -a

5.Stop a specific container.
$ docker stop [container name]

6.Stop all running containers.
$ docker stop $(docker ps -a -q)

7.Delete a specific container (only if stopped).
$ docker rm [container name]

8.Delete all containers (only if stopped).
$ docker rm $(docker ps -a -q)

9.Display logs of a container.
$ docker logs [container name]

Actions #1

Updated by Y Nguyen about 2 years ago

1/What is Docker?
Docker is a portable application platform used for developing, packaging, and deploying applications. It allows you to create lightweight, self-sufficient environments called "containers" to contain applications and all their dependencies. Containers can run on any operating system that supports Docker without requiring modifications to the application's source code.
2/When to use/not use Docker (pros/cons)?
When to Use Docker:
  • Application Portability
  • Microservices Architecture
  • Development and Testing
  • Continuous Integration and Continuous Deployment (CI/CD
  • Resource Efficiency
  • Scaling and Load Balancing
    When Not to Use Docker:
  • Simple Applications
  • Resource-Intensive Workloads
  • Stateful Applications
  • Tight Hardware Integration
  • Windows-Only Environments
  • Resistance to Change
    Pros of Docker:
  • Portability and Packaging
  • Environment Independence
  • Good Performance
  • Scalability
  • Large Community and Rich Ecosystem
    Cons of Docker:
  • Complexity
  • Security
  • Image Size
  • State Management
  • Resource Isolation
  • Windows Support
    3/What is Docker-compose ?
    Docker Compose is a tool for defining and running multi-container Docker applications. It allows you to define the services, networks, and volumes for your application in a single, easy-to-read file called a "docker-compose.yml" file. This file specifies how to connect multiple containers together to form a complete application stack. With Docker Compose, you can define complex application environments and launch them with a single command.
    4/Common docker/docker-compose commands
    Common docker
    1. Go live with docker run
    docker run docker/whalesay Hi
    2. Manage user access with sudo vs. root
    sudo usermod -G docker username

3. Retrieve images with docker pull
docker pull ubuntu:latest

4. Make a new container with docker create

5. Stop container instances with docker stop
docker stop (container ID)

6. Check container status with docker ps

7. Use a Dockerfile to create an image with docker build
docker build -t mydockertest dockerfile.

8. Control container versions with docker tag
docker tag IMAGE ID image/TAG.

Docker compose Command
1.List your images.
$ docker image ls

2.Delete a specific image.
$ docker image rm [image name]

3.Delete all existing images.
$ docker image rm $(docker images -a -q)

4.List all existing containers (running and not running).
$ docker ps -a

5.Stop a specific container.
$ docker stop [container name]

6.Stop all running containers.
$ docker stop $(docker ps -a -q)

7.Delete a specific container (only if stopped).
$ docker rm [container name]

8.Delete all containers (only if stopped).
$ docker rm $(docker ps -a -q)

9.Display logs of a container.
$ docker logs [container name]

Actions #2

Updated by Minh Le about 2 years ago

  • Subject changed from Docker learning phase 1[Y] to Docker learning phase 1 [Y]
Actions

Also available in: Atom PDF