Docker's Remote API can be secured via TLS and client certificate verification.
First of all you need a few certificates and keys:
- CA certificate
- Server certificate
- Server key
- Client certificate
- Client key
| # Backup | |
| docker exec CONTAINER /usr/bin/mysqldump -u root --password=root DATABASE > backup.sql | |
| # Restore | |
| cat backup.sql | docker exec -i CONTAINER /usr/bin/mysql -u root --password=root DATABASE | |
| # Here's how to back up a named volume | |
| # 1. Using a `ubuntu` image, we mount the named volume (`myproj_dbdata`) to a `/dbdata` folder inside the `ubuntu` container. | |
| # 2. Then, we create a new folder inside the `ubuntu` container named `/backup`. | |
| # 3. We then create an archive containing the contents of the `/dbdata` folder and we store it inside the `/backup` folder (inside the container). | |
| # 4. We also mount the `/backup` folder from the container to the docker host (your local machine) in a folder named `/backups` inside the current directory. | |
| docker run --rm -v myproj_dbdata:/dbdata -v $(pwd)/backups:/backup ubuntu tar cvf /backup/db_data_"$(date '+%y-%m-%d')".tar /dbdata |
| package main | |
| import( | |
| "log" | |
| "net/url" | |
| "net/http" | |
| "net/http/httputil" | |
| ) | |
| func main() { |
| #!/bin/bash | |
| ver=2.2.0 | |
| jar=swagger-codegen-cli-$ver.jar | |
| md5=57e673eb334364ab614cc6083b0f4b27 | |
| repo="http://repo1.maven.org/maven2/io/swagger/swagger-codegen-cli/$ver/$jar" | |
| if [ ! -f $jar ]; then | |
| echo "[info] downloading $PWD/$jar from $repo" 1>&2 | |
| if ! curl --location --silent --fail --remote-name $repo -o $jar; then |
| version: '3' | |
| services: | |
| postgres: | |
| image: postgres:9.5 | |
| restart: always | |
| environment: | |
| - POSTGRES_USER=${POSTGRES_USER-root} | |
| - POSTGRES_PASSWORD=${POSTGRES_PASSWORD-root} | |
| - POSTGRES_DB=gogs | |
| volumes: |
| package main | |
| import ( | |
| "log" | |
| "net/smtp" | |
| ) | |
| func main() { | |
| send("hello there") | |
| } |
| <!doctype html> | |
| <title>Site Maintenance</title> | |
| <style> | |
| body { text-align: center; padding: 150px; } | |
| h1 { font-size: 50px; } | |
| body { font: 20px Helvetica, sans-serif; color: #333; } | |
| article { display: block; text-align: left; width: 650px; margin: 0 auto; } | |
| a { color: #dc8100; text-decoration: none; } | |
| a:hover { color: #333; text-decoration: none; } | |
| </style> |
| #!/usr/bin/env bash | |
| # This script is meant to build and compile every protocolbuffer for each | |
| # service declared in this repository (as defined by sub-directories). | |
| # It compiles using docker containers based on Namely's protoc image | |
| # seen here: https://github.com/namely/docker-protoc | |
| set -e | |
| REPOPATH=${REPOPATH-/opt/protolangs} | |
| CURRENT_BRANCH=${CIRCLE_BRANCH-"branch-not-available"} |
| image: node:6.5.0 # can be upgraded, depending on your node version used | |
| pages: | |
| stage: deploy | |
| script: | |
| - npm install | |
| - npm run build | |
| - rm -rf public | |
| - mv build public | |
| artifacts: |