Git Product home page Git Product logo

docker_interface's Introduction

Docker Interface Build Status Development Status

Docker Interface (DI) is a declarative interface for building images and running commands in containers using Docker. At Spotify, we use Docker Interface to minimise environment drift by running all of our code in containers–during development, production, or to train machine learning models.

Installing Docker Interface

You can install Docker Interface using the following pip command (you need a python3 interpreter).

pip install docker-interface

To check that Docker Interface was installed successfully, run

di --help

Using Docker Interface

Docker Interface can be invoked from the command line. By default, it reads the configuration from the file di.yml in the current working directory, a basic version of which is shown below.

build:
  tag: name-of-your-image

Docker interface supports two commands:

  • build builds and tags Docker image using the current working directory as the build context.
  • run runs a Docker command in a container and mounts the current working directory with appropriate permissions at /workspace so you can access your local files without having to rebuild the image.

You can find more extensive examples in the examples folder in this repository. You can find more detailed information here. Check the schema to get a comprehensive overview of the declarative syntax supported by Docker Interface.

Contributing to Docker Interface

To contribute to the development of Docker Interface, please create a fork of the repository and send any changes as a pull request.

You can test your local installation of Docker Interface as follows.

# 0. Set up a virtual environment (optional but recommended)
# 1. Install development requirements
pip install -r requirements.txt
# 2. Run the tests
make tests

See virtualenv or conda for details on how to set up a virtual environment in step 0.

Code of conduct

This project adheres to the Open Code of Conduct. By participating, you are expected to honour this code.

docker_interface's People

Contributors

adliska avatar dizzeepascall avatar jdonier avatar jkp avatar tillahoffmann avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

docker_interface's Issues

Improve error message when no `di.yml` is found, or `di.yml` is empty

Currently, when running without a di.yml file, one gets the following error. Since this will be a common thing, the output should probably be a bit more user-friendly.

$> di build                                                                                                               ⏎
Traceback (most recent call last):
  File "/Users/tw/miniconda3/bin/di", line 11, in <module>
    load_entry_point('docker-interface==0.2.6', 'console_scripts', 'di')()
  File "/Users/tw/miniconda3/lib/python3.5/site-packages/docker_interface/cli.py", line 33, in entry_point
    configuration = base.apply(configuration, None, args)
  File "/Users/tw/miniconda3/lib/python3.5/site-packages/docker_interface/plugins/base.py", line 246, in apply
    "missing configuration; could not find configuration file '%s'" % args.file)
FileNotFoundError: missing configuration; could not find configuration file 'di.yml'

Equally, when the di.yml is empty, the output currently is:

$> di build                                                                                                                 ⏎
Traceback (most recent call last):
  File "/Users/tw/miniconda3/bin/di", line 11, in <module>
    load_entry_point('docker-interface==0.2.7', 'console_scripts', 'di')()
  File "/Users/tw/miniconda3/lib/python3.5/site-packages/docker_interface/cli.py", line 33, in entry_point
    configuration = base.apply(configuration, None, args)
  File "/Users/tw/miniconda3/lib/python3.5/site-packages/docker_interface/plugins/base.py", line 247, in apply
    configuration['workspace'] = os.path.join(dirname, configuration.get('workspace', '.'))
AttributeError: 'NoneType' object has no attribute 'get'

Set a platform-independent DNS entry for the host IP.

From @sebewert:

docker.for.mac.localhost only seems to be available on mac (as indicated by the name). To have something portable, would it be a good idea to have di automatically set a DNS entry for the host IP that works independently of the host platform?

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.