Skip to content

Instantly share code, notes, and snippets.

@dkgndianko
Last active September 30, 2020 10:39
Show Gist options
  • Save dkgndianko/d92fcde74a3f4f82384cfe73df00f7da to your computer and use it in GitHub Desktop.
Save dkgndianko/d92fcde74a3f4f82384cfe73df00f7da to your computer and use it in GitHub Desktop.
Tips about docker

1. Install Docker on Debian

To install Docker Engine, visit here

sudo apt-get install \
    apt-transport-https \
    ca-certificates \
    curl \
    gnupg-agent \
    software-properties-common
curl -fsSL https://download.docker.com/linux/debian/gpg | sudo apt-key add -
sudo apt-key fingerprint 0EBFCD88
sudo add-apt-repository \
   "deb [arch=amd64] https://download.docker.com/linux/debian \
   $(lsb_release -cs) \
   stable"
sudo apt-get update
sudo apt-get install docker-ce docker-ce-cli containerd.io

Add current user to docker group

sudo groupadd docker
sudo usermod -aG docker $USER

For any other user (e.g mbaye) do:

sudo usermod -aG docker mbaye

Fix iptable problem on Debian.

Source is there

sudo update-alternatives --set iptables /usr/sbin/iptables-legacy
sudo update-alternatives --set ip6tables /usr/sbin/ip6tables-legacy

Enable docker service

 sudo systemctl enable docker

2. Restore MySql dump

Start a mysql container with existing dumps. For that mount the directory where dumps live on /docker-entrypoint-initdb.d. See Official Documentation (Initializing a fresh instance). For example in this case I have a dump of my test database, and I want to start a new Docker container that will restore that one.

docker run --name mysql_cidemia_test -v ~/databases/backups/cidemia/test:/docker-entrypoint-initdb.d -p 13306:3306 -e MYSQL_ROOT_PASSWORD=cidemia -e MYSQL_DATABASE=cidemia_dev -e MYSQL_USER=cidemia -e MYSQL_PASSWORD=cidemia mysql:5.7.20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment