Coder Social home page Coder Social logo

overshard / dockerfiles Goto Github PK

View Code? Open in Web Editor NEW
2.0 2.0 0.0 42 KB

All the Dockerfiles I use for various purposes. More detailed usage instructions are at the top of each Dockerfile.

Home Page: https://isaacbythewood.com

License: BSD 2-Clause "Simplified" License

Dockerfile 76.34% Shell 23.66%
alpine django docker docker-compose docker-desktop exim postgresql redis webdev archlinux

dockerfiles's Introduction

dockerfiles

All the Dockerfiles I use for various purposes. More detailed usage instructions are at the top of each Dockerfile.

Methodology

In general I like to build all-in-one Dockerfiles for things like general software development and I like to use docker-compose for production environments so that things like databases, caching, media storage, workers, and web hosts are split into their own containers.

Multiline

I don't like having a lot of files that I COPY around and prefer writing multiline echos and sed commands to create and adjust configuration files. When heredocs are widely supported and not just in labs I plan on using that.

Containers all the way down

You'll notice that I have some commands laying around that look something like:

docker run -it --rm -v /var/run/docker.sock:/var/run/docker.sock alpine \
  sh -c "apk add docker curl && curl -o- https://raw.githubusercontent.com/overshard/dockerfiles/master/webdev/backup.sh | sh"

This runs a docker container that then does a curl command to then run a script that runs more docker containers. I like to keep all my scripts and code based on containers and be as multi-platform as possible. I use Linux, MacOS, and Windows daily and the only way to make things work on all platforms is to just run everything in containers and have docker installed everywhere.

I also really don't like batch and powershell scripts on Windows and prefer to just use shell scripts for everything.

Quick container

I sometimes setup a quick container to do test things on with:

docker run -td --restart unless-stopped --name alpine \
    -v "/var/run/docker.sock:/var/run/docker.sock" \
    alpine ash

Then you can enter it at anytime with:

docker exec -it alpine ash

Backup volumes

To copy data from a container to the host system while using docker volumes you can run something like this:

docker run --rm --volumes-from bythewood -v "${pwd}:/data" alpine \
    tar --exclude .venv --exclude node_modules --exclude media --exclude db.sqlite3 \
    -zcvf /data/bythewood-`date +%Y-%m-%d`.tar.gz /home/dev/.ssh /home/dev/code

NOTE: Instead of using ${pwd} you can also use a full path, on Windows it'd look something like "/C/Users/Isaac Bythewood/Documents/Backups:/data". The double quotes are important to prevent errors and use spaces in the path.

Volume location on Windows

You can easily get to docker volumes on Windows by typing the following in Explorer:

\\wsl$\docker-desktop-data\data\docker\volumes

dockerfiles's People

Contributors

overshard avatar

Stargazers

 avatar  avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.