Helpsheet: Docker - Hong-Kong-Districts-Info/dashboard-hkdistrictcouncillors GitHub Wiki

Purpose: This page sets out some basic commands for using Docker.

Intro to Docker

You can learn more about Docker and why it is useful in the official documentation here.

For an R-specific intro to Docker, please see the ropenscilabs guide here.

Using renv with Docker

Instructions for including the renv package in the Dockerfile so you do not have to manually write out all the package and versions to install can be found in the official documentation here.

General commands

Below are some useful, common commands to use with docker:

# check all Docker images on system
docker images -a

# remove image
docker rmi <IMAGE_ID>

# check dangling images that consume disk-space but aren't useful
docker images -f dangling=true

# remove dangling images
docker image prune

# check currently running Docker containers
docker ps

# check all Docker containers on system
docker ps -a

# stop a running Docker container (need to do this in a separate terminal)
# note: get <CONTAINER ID> from checking your running Docker containers
docker stop <CONTAINER ID>

# delete Docker containers on system
docker rm <CONTAINER ID>

Taken from the Eduonix blog and DigitalOcean docker cheatsheet.


Building Docker images

If you wish to build the Docker image yourself, please follow the instructions. In the directory where the Dockerfile is, execute the following in your command shell (instructions for iOS):

# build and run Docker container
docker build -t hkdistrictcouncillors .
docker run -rm -p 3838:3838 hkdistrictcouncillors

# get your IP address
ipconfig getifaddr en0

Then, in your web-browser, type in:

http://<your_ip_address>:3838/
⚠️ **GitHub.com Fallback** ⚠️