Docker is used to manage individual container on the docker engine. Docker-compose is used to manage a multi-container application. It works like a "script" on top of Docker.
A docker container image is a lightweight, sandlestone exectutable package of software that includes everything needed to run an application.
The key difference between the docker Dockerfile and docker-compose is that the docker Dockerfile describes how to build Docker images, while docker-compose is used to run Docker containers.
Virtual machines have host OS and the guest OS inside each VM. Guest OS can be any OS, like Linux or Windows, irrespective of host OS. Virtual machines are needed if the applications or services required to run on different OS.
Docker containers host on a single physical server with a host OS, which shares among them. Sharing the host OS between containers makes them light and increases the boot time. Docker containers are considered suitable to run multiple applications over a single OS kernel.
sudo adduser login
sudo usermod -aG sudo login
sudo usermod -aG docker login
docker ps
docker exec -it <container name> /bin/sh
docker run -it wp
docker build -t image_name .
docker run image_name
docker system df
List networks:
docker network ls
docker network connect <network> <container>
docker network disconnect <network> <container>
docker rmi $(docker images)
docker rm $(docker ps -a)
Remove all unused containers, networks, images (both dangling and unreferenced), and optionally, volumes.
docker system prune
docker volume prune
docker system prune -af
docker build -t image_name .
docker run --name [nameofyourcontainer] -p 80:80 -d [nameofyourimage]
https://mariadb.com/kb/en/creating-a-custom-docker-image/
sudo usermod -aG docker ${USER}
su -${USER}
"ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock' (2)"
mkdir -p /var/run/mysqld
chown mysql:mysql /var/run/mysqld
If it doesn't fix anything, rebuild a new vm and do:
sudo service mysql stop
mysql -h 127.0.0.1 -u wp -p (password: wp42)
show databases;
use wordpress;
show tables;
SELECT * FROM wp_comments;
Then you need to connect as admin to your wp website and approuve the comments or they won't appears at restart etc...
sudo service nginx stop
sudo service mysql stop