Docker
images
list images (with containers you can start)
docker images
pull images
docker pull bitnami/mariadb:latest
containers
list containers
docker ps
stop kill container
docker stop / kill name
run a container
docker run -d -p 80:80 --name suitecrm --net=suitecrm-tier bitnami/suitecrm docker run -e ALLOW_EMPTY_PASSWORD=yes -v mariadb_data:/bitnami bitnami/mariadb:latest
docker run populates a new container, docker start restarts a prepopulated container. ?
This is important if you get errors like "the name is already in use by container"
networks
docker network list find which containers are using a network <pre> docker network inspect name
detach a network from a container
docker network disconnect networkname containername
allowing access to the containers on the bridge network from the outside
$ sysctl net.ipv4.conf.all.forwarding net.ipv4.conf.all.forwarding = 0 $ sysctl net.ipv4.conf.all.forwarding=1 $ sysctl net.ipv4.conf.all.forwarding net.ipv4.conf.all.forwarding = 1
voumes
create a volume
docker volume create --label mariadb_data --name mariadb_data
list volumes
docker volume ls
view details on volume
docker volume inspect volumename
The mountpoint is what you should put in the voumes: /path/to/persistence in docker-
compose.yml
remove volume
docker volume rm volumename
Accessing a shell in a container
docker exec -it name /bin/bash
Links
https://www.digitalocean.com/community/tutorials/how-to-install-and-use-docker-compose-
on-centos-7
Bitami specific
mariadb
mkdir /mariadb cd /mariadb
EITHER docker run -e ALLOW_EMPTY_PASSWORD=yes -v mariadb_data:/bitnami
bitnami/mariadb:latest
OR
vi docker-compose.yml
NB Volumes mountpoint can be found using docker volume inspect mariadb_data
version: '2' networks: app-tier: driver: bridge services: mariadb: image: 'bitnami/mariadb:latest' environment: - ALLOW_EMPTY_PASSWORD=yes ports: - '3306:3306' volumes: - /var/lib/docker/volumes/mariadb_data/_data:/bitnami networks: - app-tier
docker-compose up -d
To connect a client:
docker run -it --rm --network mariadb_app-tier bitnami/mariadb:latest mysql -h mariadb_mariadb_1 -u root
after install sudo mysql_secure_installation
more options at
https://github.com/bitnami/bitnami-docker-mariadb#persisting-your-database