Docker Tips

Run a container from the Alpine version 3.9 image, name the running container “web” and expose port 5000 externally, mapped to port 80 inside the container.
docker container run --name web -p 5000:80 alpine:3.9
Stop a running container through SIGTERM
docker container stop web
Stop a running container through SIGKILL
docker container kill web
List the networks
docker network ls
List the running containers (add –all to include stopped containers)
docker container ls
Delete all running and stopped containers
docker container rm -f $(docker ps -aq)
Print the last 100 lines of a container’s logs
docker container logs --tail 100 web

Installing Docker

Link
sudo su
apt update
apt -y upgrade
Install using the convenience script
curl -fsSL https://get.docker.com -o get-docker.sh
sudo sh get-docker.sh
If you would like to use Docker as a non-root user, you should now consider adding your user to the “docker” group with something like: https://docs.docker.com/engine/install/linux-postinstall/
sudo su
groups # list groups
sudo groupadd docker
sudo usermod -aG docker $USER
newgrp docker # activate group
Verify that Docker Engine is installed correctly by running the hello-world image.
docker run hello-world
I couldn’t get it to work until I ran
sudo chmod 666 /var/run/docker.sock
See this page https://www.digitalocean.com/community/questions/how-to-fix-docker-got-permission-denied-while-trying-to-connect-to-the-docker-daemon-socket https://docs.docker.com/engine/install/linux-postinstall/
chkconfig

Jupyter Server

Tutorial: Running a Dockerized Jupyter Server for Data Science Jupyter Docker versions

PostgreSQL

Don’t install Postgres. Docker pull Postgres.