Coder Social home page Coder Social logo

wangzhijie2016 / docker-dev Goto Github PK

View Code? Open in Web Editor NEW

This project forked from aghost-7/docker-dev

0.0 1.0 0.0 1.12 MB

Docker images for portable development environments

Dockerfile 21.13% Python 22.92% Shell 30.06% Vim Script 23.60% JavaScript 2.21% Scala 0.09%

docker-dev's Introduction

Docker Dev

Spin up a container to develop from anywhere!

docker-dev

To run, just:

docker run -ti aghost7/nodejs-dev:boron tmux new

Alternatively, if on Linux:

python3 -m pip install --user slipway
slipway start aghost7/nodejs-dev:carbon

Images

Language Images

  • ubuntu-dev-base: Ubuntu image with a few presets such as docker of already installed. It is also configured to allow passwordless sudo just like those vagrant images. Tags available:
    • latest: Ubuntu xenial based image.
    • bionic: Ubuntu Bionic Beaver (18.04) image.
  • power-tmux: Powerline + Tmux. Based from the ubuntu-dev-base image. Images available:
    • bionic
  • nvim: NeoVim image. Based from ubuntu-tmux. Language agnostic vim setup (no language-specific plugins in there). Images available:
    • bionic
  • nodejs-dev: nvm + nodejs specific configurations. Tags available:
    • bionic-carbon: Ubuntu 18.04 + NodeJs 8.
    • bionic-dubnium: Ubuntu 18.04 + NodeJs 10.
  • rust-dev: NeoVim configuration and autocomplete for the Rust language.
    • stable uses rust stable with YouCompleteMe backed by only racer.
    • nightly uses rust nightly with deoplete backed by RLS.
  • py-dev: Python configuration with autocomplete for python and ptpython.
    • bionic: Ubuntu 18.04 + python 3.6
  • ruby-dev: Ruby image with language server. Tags:
    • bionic: Ruby 2.3 pre-installed.
  • c-dev: Ubuntu Bionic image for c development with cquery for completions. There is only a bionic tag.

Database Images

  • pg-dev: Postgresql image with pgcli, a command line client with autocompletions and syntax highlighting. Tags correspond to the Postgresql version:
    • 9.3
    • 9.6
    • 10
    • 11
  • my-dev: MySql image with mycli utility. Tags correspond to the mysql version:
    • 5.6
    • 5.7
    • 8.0
  • mongo-dev: Official mongodb image with Mongo Hacker added. Tags correspond to the mongdb version:
    • 4.1

Vim Configuration

Vim configurations are broken down into three parts:

  • init.vim: This is the equivalent for .vimrc in NeoVim.
  • plugin.vim: This contains all plugins which will be installed using vim.plug.
  • post-plugin.vim: Contains all plugin-specific configurations for Neovim. Configurations which aren't plugin-specific reside in the init.vim file.

Breaking it down this way allows one to just run cat addition.vim >> $XDG_CONFIG_PATH/file to add new plugins and configs for specific programing languages and libraries.

Calling Docker on the Host

The docker daemon run over a socket. The command line tool is just a client to the daemon. In other words, if we make the socket connectable from within the container we're in business.

For some reason it needs privileged to work as well.

docker run -ti --rm \
	--privileged \
	-v `readlink -f /var/run/docker.sock`:/var/run/docker.sock \
	aghost7/ubuntu-dev-base:latest \
	tmux new

SSH Forwarding and Git

For ssh, just pass the socket over to the container.

docker run -ti --rm \
	-v $SSH_AUTH_SOCK:$SSH_AUTH_SOCK \
	-e SSH_AUTH_SOCK=$SSH_AUTH_SOCK \
	aghost7/ubuntu-dev-base:latest \
	tmux new

I like to avoid having to reconfigure git every time, so I mount a volume for .gitconfig. ~/.ssh/known_hosts is also anoying.

Getting the Clipboard Working

Basically, X11 is built in a manner that allows sending display data over the wire. I've managed to run GUI applications from a headless server through an ssh connection in the past. The way I'm doing this is through the same old unix socket trick for controlling the docker daemon that's on the host machine.

docker run -ti --rm \
	-e DISPLAY=$DISPLAY \
	-v /tmp/.X11-unix:/tmp/.X11-unix:ro \
	aghost7/ubuntu-dev-base:latest bash

On the host you'll need to disable one of the security features in X11.

xhost +si:localuser:$USER > /dev/null

Source: http://stackoverflow.com/questions/25281992/alternatives-to-ssh-x11-forwarding-for-docker-containers

Complete Example Startup Script

This is what I use on my current machine to get it working with everything.

https://github.com/AGhost-7/dotfiles/blob/master/bin/dev

docker-dev's People

Contributors

aghost-7 avatar hardy925 avatar literallynotjesus avatar

Watchers

 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.