docs.daveops.net

Snippets for yer computer needs

Containers

Docker

Installing on Mac

brew cask install docker

CLI

# list all containers
docker ps -a
# remove a container
docker rm [container_id|name]
# restart a container
docker restart [container]
# build a docker image from a Dockerfile
docker build -t TAGNAME . # in dir of Dockerfile
# create a docker container
docker create TAGNAME
# create and run a docker container, open a shell
docker run --name CONTAINERNAME -it

Docker compose

docker-compose up
version: "3.8"
services:
  api:
    build:
      dockerfile: ./Dockerfile.api
    ports:
      - 4567:4567
    links:
      - url_cache
  url_cache:
    image: memcached

Docker stack

https://docs.docker.com/engine/reference/commandline/stack/

Dockerfile syntax

Must use “, not ‘

FROM image_name:image_tag
LABEL maintainer="person <person@example.org>"
RUN install_things
CMD ["executable", "--to", "--run"]

Logs

docker logs <CONTAINER>

See also /var/lib/docker/containers/<ID>/<ID>-json.log

Docker registry

docker run -d -p 5000:5000 --restart=always --name registry registry:2

podman

https://podman.io/blogs/2019/01/16/podman-varlink.html

Change to cgroups v1

sudo grubby --update-kernel=ALL --args="systemd.unified_cgroup_hierarchy=0"

Habitat

Install on macOS

# Install hab
brew tap habitat-sh/habitat
brew install hab

# Setup
hab cli setup