Skip to content

Instantly share code, notes, and snippets.

View rwcitek's full-sized avatar

Robert Citek rwcitek

View GitHub Profile
@rwcitek
rwcitek / pyscript.docker.md
Created February 8, 2023 23:27
Playing with PyScripts using Docker
@rwcitek
rwcitek / data.science.cli.md
Last active April 3, 2023 01:32
Docker container with Data Science CLI tools

Commands for creating a Docker container inspired by Data Science at the Command Line, 2nd Edition

# clean up namespace
docker container stop ds_cli  ; docker container rm ds_cli 

# run instance as service
docker container run -d -v /tmp/ds_cli:/tmp/ds_cli --name ds_cli ubuntu:22.04 sleep inf
@rwcitek
rwcitek / mongodb.client.docker.sh
Last active January 25, 2023 17:20
MongoDB client in Docker on Ubuntu 22.04
# remove any existing Docker instance
docker container stop mongodb ; docker container rm mongodb
# start a Docker instance as a service
docker container run -d --name mongodb ubuntu:22.04 sleep inf
# install packages
docker container exec -i mongodb /bin/bash << 'eof'
export DEBIAN_FRONTEND=noninteractive
apt-get update
@rwcitek
rwcitek / mqtt.mosquitto.docker.phase-01.sh
Last active July 10, 2023 04:24
An example pub/sub using mosquitto in Docker
# === Subscriber and publisher in single container, eclipse broker
# remove any existing container
docker container stop mosquitto ; docker container rm mosquitto
# start the instance in the background ( and create an image, if needed )
docker image list -a | grep -q mosquitto &&
docker container run -d --name mosquitto mosquitto sleep inf || {
@rwcitek
rwcitek / RPi.Docker.install.sh
Last active December 13, 2022 17:47
Instructions for downloading and imaging the Raspberry Pi 3 image to a USB drive
# From: https://www.simplilearn.com/tutorials/docker-tutorial/raspberry-pi-docker
curl -fsSL https://get.docker.com -o get-docker.sh
sudo sh get-docker.sh
sudo usermod -aG docker ${USER}
exec sudo su - ${USER}
docker image pull ubuntu:22.04
@rwcitek
rwcitek / mongodb-client.ubuntu-22.04.docker.md
Last active January 25, 2023 17:11
Installing mongodb client on Ubuntu 22.04 in a Docker container
# This should be turned into a multi-stage Dockerfile
docker container stop build_haskell ; docker container rm build_haskell ; sleep 1
docker container run -d --name build_haskell ubuntu:20.04 sleep inf
<<'eof' docker container exec -i -w /tmp/ build_haskell /bin/bash
export DEBIAN_FRONTEND=noninteractive
apt-get update
apt-get install -y vim tree jq file wget gcc g++ make xz-utils curl
@rwcitek
rwcitek / aoc.2022.day01.sh
Last active December 5, 2022 01:56
Advent of Code 2022 - day 01
# Using a shell pipeline of awk, bc, sort, head in Docker with the Alpine image
<<'eof' docker container run --rm -i alpine
{ cat <<'eof2'
1000
2000
3000
4000
@rwcitek
rwcitek / haskell.docker.sh
Last active December 3, 2022 16:45
Installing haskell in an Ubuntu Docker container
# These commands were run using the bash shell on Debian 11 in the Linuv Dev Env on a Chromebook
# make sure no haskell instances exist
docker container stop haskell ; docker container rm haskell ; sleep 2
# run an Ubuntu container in the background
docker container run -d --name haskell ubuntu:22.04 sleep inf
# install utilities and haskell
<<'eof' docker container exec -i haskell /bin/bash

This file shows how one can configure a Docker instance to create a serverless function on Digital Ocean. Rather than running doctl auth init ... to set up a config.yaml file that holds the API token, the container exec command passes in an environment variable that contains the token. In that way, the container never has the token on persistent storage. That means the instance could be committed to an image without having credentials in the image. It also means the commands in the Here-Doc could be used as as a template to create a Dockerfile in the future.

From DO function docs

Create a Docker container