e.g. docker run --privileged --cgroupns=host --name mariadb -d -p 3306:3306 -v /Users/Shared/workspace/docker/maria-data:/var/lib/mysql -v /sys/fs/cgroup:/sys/fs/cgroup:rw -e MARIADB_ROOT_PASSWORD=mariadb hjben/mariadb:10.11
Command Description
-d: Run with daemon (background) mode
--privileged: Share the host permission with container
--cgroupns=host: Privilege the host's group
--name {container_name}: Set container name to {container_name}
-v /sys/fs/cgroup:/sys/fs/cgroup:rw: Share the disk volume between host and container, to access host cgroup from the container
-p 3306:3306: Expose 3306 port of the container
-v {host_path_to_save_DB_data}:/var/lib/mysql: Share the disk volume between host and container, to save the MariaDB data in {host_path_to_save_DB_data}
-e MARIADB_ROOT_PASSWORD={mariadb_password_you_want}: Pass the custom mariadb root password to container