Spread the love

Docker key components

  1. Network: The docker managed network, which can be used to isolate processes. You can think of it like VNet but with multiple types of network. Default is bridge network.
  2. Volume: To hold the persisted data. Docker containers are stateless, means once they are stopped or remove the data will be lost. So, to keep data or move data or to share data we can use volumes.
  3. Services: The actual process which will execute. It is an instance of an docker image.

The commands to run

docker create network mariadb
docker create volume mariadb
docker run --name mariadb -e MARIADB_ROOT_PASSWORD=MyPass -p 3306:3306 --volume mariadb:/var/lib/mysql --network mariadb -d mariadb:latest

So, these three simple commands will work the magic.

Docker compose can be used, but since it’s a standalone container that we are running so no need for that.

Docker compose is very useful for the orchestration of mutliple services, networks, volumes, environement values (using .env file). We can have health checks dependecies.

Cheers and Peace out!!!

Leave a Reply

Your email address will not be published. Required fields are marked *