Docker

Running any container from Docker Hub

There isn't much support for Docker just yet in freckles, but it's very easy to use it as a wrapper cli-application to start any of the docker images on Docker Hub. Here's how we can use one command to install Docker (if it's not installed yet), add our user to the Docker group (for good measure), and then execute the nextcloud docker image with one persistent data volume mounted, the the service port forwarded to local port 9090:

# run via: freckles --vars <this_file> docker-container-running
users:
  - markus
name: nextcloud
image: nextcloud
ports:
  - "9090:80"
volumes:
  - "/home/markus/docker_data/nextcloud:/var/www"  
frecklecute docker-container-running \
    --user markus \
    --volume "/home/markus/docker_data/nextcloud:/var/www" \
    --port "9090:80" \
    --name: nextcloud \
    --image: nextcloud

Wrap any container from Docker Hub in a frecklet

If you want to make it easier for users who are not familiar with Docker (or any other reason) to install Docker and run your (or any other) image from Docker hub, you can easily wrap that process in an easy-to-use frecklet.

One example would be the nextcloud-standalone-docker frecklet, which wraps the 'nextcloud' Docker image from the example above. Check out it's source code to get an idea how little is involved. This is how we'd run that:

# run via: freckles --vars <this_file> nextcloud-standalone-docker
ensure_docker_installed: true
user: markus
persistent_data: "/home/markus/data/nextcloud"
port: 9090
image: nextcloud
container_name: nextcloud
frecklecute nextcloud-standalone-docker \
    --ensure-docker-installed \
    --user markus \
    --persistent-data /home/markus/data/nextcloud \
    --port 9090 \
    --container-name nextcloud

If you create a 'wrapper' frecklet like that, everyone who you share it with will be able to setup the complete service (incl. Docker setup itself) with one command.

frecklets used:

Building a Docker image from one or more frecklets

This is kinda cool, you can build a Docker image using one or multiple frecklets, directly from freckles.

This will dynamically create a Dockerfile that contains freckles bootstrap code, and instructions to run frecklecute with the 'java-lang-installed' and 'go-lang-installed' frecklets, then it will delete freckles itself to free up some space. If you wanted, you could change the base image, the default is Ubuntu 18.04.

frecklecute docker-image-from-frecklets \
    -f java-lang-installed \
    -f go-lang-installed \
    --name freckles-java-go

frecklets used: