Docker

¿What is Docker?

Docker is a platform and this platform helps us to create packages with all dependencies

Docker

To execute Docker it's necessary Docker Engine is the kernel of Docker and the applications run over there

To execute a VM needs to allocate the resources, RAM, processor, and disk space, and not is possible to share with other VMs, because are busy

Virtual Machine

VM's VS Docker image

Docker Installation

Docker Engine

https://hub.docker.com/

Text

Basic commands

sam@Scarlet:/$ docker ps

CONTAINER ID  IMAGE         COMMAND   CREATED        STATUS
d03ba4afb47c  wordpressdb  /bin/bash 10 seconds ago Up 9 seconds

sam@Scarlet:/$ docker logs d03ba4afb47c
sam@Scarlet:/$ docker stop d03ba4afb47c
sam@Scarlet:/$ docker kill d03ba4afb47c
sam@Scarlet:/$ docker start d03ba4afb47c

Example

Search Wordpress

Run the database

docker run -d --name wordpress-db \

--mount source=wordpress-db,target=/var/lib/mysql \

-e MYSQL_ROOT_PASSWORD=secret \

-e MYSQL_DATABASE=wordpress \

-e MYSQL_USER=manager \

-e MYSQL_PASSWORD=secret mariadb:10.3.9

Run the app

docker run -d --name wordpress \
    --link wordpress-db:mysql \
    --mount type=bind,source="$(pwd)"/target,target=/var/www/html \
    -e WORDPRESS_DB_USER=manager \
    -e WORDPRESS_DB_PASSWORD=secret \
    -p 8080:80 \
    wordpress:4.9.8

localhost

Copy of Docker

By Samuel LR

Copy of Docker

  • 65