Giter Site home page Giter Site logo

docker / compose-cli Goto Github PK

View Code? Open in Web Editor NEW
954.0 29.0 252.0 8.78 MB

Easily run your Compose application to the cloud with compose-cli

License: Apache License 2.0

Makefile 0.87% Go 96.47% Dockerfile 1.20% JavaScript 0.12% HTML 0.14% CSS 0.20% Java 0.20% Shell 0.80%
cli docker docker-compose azure amazon-web-services azure-aci amazon-ecs fargate docker-engine moby

compose-cli's Introduction

The Moby Project

Moby Project logo

Moby is an open-source project created by Docker to enable and accelerate software containerization.

It provides a "Lego set" of toolkit components, the framework for assembling them into custom container-based systems, and a place for all container enthusiasts and professionals to experiment and exchange ideas. Components include container build tools, a container registry, orchestration tools, a runtime and more, and these can be used as building blocks in conjunction with other tools and projects.

Principles

Moby is an open project guided by strong principles, aiming to be modular, flexible and without too strong an opinion on user experience. It is open to the community to help set its direction.

  • Modular: the project includes lots of components that have well-defined functions and APIs that work together.
  • Batteries included but swappable: Moby includes enough components to build fully featured container systems, but its modular architecture ensures that most of the components can be swapped by different implementations.
  • Usable security: Moby provides secure defaults without compromising usability.
  • Developer focused: The APIs are intended to be functional and useful to build powerful tools. They are not necessarily intended as end user tools but as components aimed at developers. Documentation and UX is aimed at developers not end users.

Audience

The Moby Project is intended for engineers, integrators and enthusiasts looking to modify, hack, fix, experiment, invent and build systems based on containers. It is not for people looking for a commercially supported system, but for people who want to work and learn with open source code.

Relationship with Docker

The components and tools in the Moby Project are initially the open source components that Docker and the community have built for the Docker Project. New projects can be added if they fit with the community goals. Docker is committed to using Moby as the upstream for the Docker Product. However, other projects are also encouraged to use Moby as an upstream, and to reuse the components in diverse ways, and all these uses will be treated in the same way. External maintainers and contributors are welcomed.

The Moby project is not intended as a location for support or feature requests for Docker products, but as a place for contributors to work on open source code, fix bugs, and make the code more useful. The releases are supported by the maintainers, community and users, on a best efforts basis only, and are not intended for customers who want enterprise or commercial support; Docker EE is the appropriate product for these use cases.


Legal

Brought to you courtesy of our legal counsel. For more context, please see the NOTICE document in this repo.

Use and transfer of Moby may be subject to certain restrictions by the United States and other governments.

It is your responsibility to ensure that your use and/or transfer does not violate applicable laws.

For more information, please see https://www.bis.doc.gov

Licensing

Moby is licensed under the Apache License, Version 2.0. See LICENSE for the full license text.

compose-cli's People

Contributors

afshin-deriv avatar aiordache avatar chris-crone avatar crazy-max avatar crosbymichael avatar dependabot-preview[bot] avatar dependabot[bot] avatar eunomie avatar flaviostutz avatar glours avatar gtardif avatar julientant avatar justincormack avatar landism avatar lorenrh avatar mat007 avatar metcalfc avatar mikesir87 avatar milas avatar mreferre avatar nahuel-soldevilla avatar ndeloof avatar nicksieger avatar p1-0tr avatar paco-valverde avatar rfay avatar rumpl avatar sarathkumarsivan avatar thajeztah avatar ulyssessouza 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  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  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  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

compose-cli's Issues

ACI : update Azure client ID in azure login

Currently we're using azure az CLI client ID, and calls to azure will be associated with the az command line.
MS must provide us a new client ID that will be specific to docker CLI, we'll need to update the id associated with login.

New CLI : improve error message when trying to use unsupported commands with new backends

Currently the spike changes the list of commands based on the context. if a user tries to use old commands that are not supported with aci/ecs, we return a generic error message :

 $ docker-cli  --context aci swarm init
docker: 'swarm' is not a docker command.
See 'docker --help'

We need to change this message to make it very explicit the command is not available because of the context switch, and it only exists in the "old" non-cloud context (and non-d2).

Pkg : start `docker serve` from desktop for win

Docker Desktop must start the docker cli on a predefined named pipe. The SDK must connect by default on this npipe on win, if no specific socket is provided by the user.

  • start cli serve when Desktop starts
  • stop cli serve when Desktop stops

SDK will not start the daemon if not available

Linux : document packaging / install of new CLI

Since there is no Desktop on Linux, we must document how users should install the new CLI

  • how do we distribute it for linux users, how do they download it along with classic cli
  • where to install it, and make sure the shell out to docker-classic works fine

ACI : replace docker exec to write /etc/hosts file by a sidecar container

Currently, in order to allow service name resolution within a compose stack, once the compose containers have been started in ACI, we docker exec inside one of the containers to write service names in /etc/hosts.
This requires containers to allow /bin/sh execution, and is done after all containers are running.
We should replace this docker exec by adding a side car container to the compose stack, the side car doing nothing but writing service names to /etc/hosts.
the ps implementation will need to filter out the side car containers so that they are not visible to users

Run help shows random name

The help for --name includes the randomly generated name.

$ ./bin/docker run --help
...
      --name string           Assign a name to the container (default "crazy-allen")

The existing CLI just shows:

$ docker run --help
...
      --name string                    Assign a name to the container

Context management : add docker context use

currently the new CLI only has context ls / context create command.
e2e test is using directly the old CLI in order to switch context, we must update e2e to run docker context use on the new CLI

SDK : provide a method to let MS know if context is default type or not

  • List contexts
  • get current context and context type (to know if VSCode must use dockerode or not)
    In cases where the new CLI is not installed, the SDK must be able to answer current context / type without connecting to the server (possibly getting the info from error connecting to the backend, or getting contexts from the cli cmdline directly)

Data capture in new CLI - foundation

Scope
Implement data capture for just the number of 'run' events which is stored in a way that Docker Desktop could pick up.
This should aggregate over a 24 hour period and be written to a file that Desktop can pick up.

Goal
prove data capture from CLI and 'pick up' from Desktop

Background
We cannot capture data in the Docker Desktop proxy as the proxy would need to have full knowledge of all the flags. Instead this must be done in the cli. As this will therefore be open source it will need to default to off and have a standard, user auditable way of collecting the metrics.

The current suggestion is to have a common metrics collection interface in cli that links into the cobra commands. The backend for this interface could be:

A simple file backend that the Docker Desktop service reads the data from.
Separate Windows and Mac backends that forward the command usage to the Docker Desktop APIs. What backend to use should be configurable.

Previous suggestion was to use prometheus with local file storage to gather the metrics. Docker Desktop can periodically read and clear this.

ACI : Adjust container IDs between all comands

We need to have consistent container IDs that allow to match output of docker ps with docker logs, docker exec and docker inspect.
This must work for single containers and also compose stack containers.
Single containers are fine, the container id is either generated or provided when the container is created first.
Compose stack : we need a way to identify both the compose project (mapped to a container group in ACI, also used for compose down and possibly other compose commands, logs...) and the container ID. A naming convention : container id = composeProjectName_service_name seems to work fine, it makes things easy to process technically, and also makes things easy to understand for a user when they do docker ps, like with local compose containers

Contexts : do not allow creation of context with type "foo"

 $ ./bin/docker context create test1 toto
 $ ./bin/docker context ls
NAME                TYPE                DESCRIPTION                               DOCKER ENPOINT                KUBERNETES ENDPOINT                                 ORCHESTRATOR
default *           docker              Current DOCKER_HOST based configuration   unix:///var/run/docker.sock   https://kubernetes.docker.internal:6443 (default)   swarm
test1               toto                                                            

We must check the type and allow only types known by existing backends, or docker ("empty" type)

Pkg : start `docker serve` from desktop for mac

Docker Desktop must start the docker cli on a predefined unix socket. The SDK must connect by default on this socket on mac, if no specific socket is provided by the user.

  • start cli serve when Desktop starts
  • stop cli serve when Desktop stops

SDK will not start the daemon if not available

ACI : provide an API/SDK for external tools (VS Code)

External tools must be able to fetch information when docker context is switched to a non-docker daemon context (there is no more daemon API)
we must provide a way for external tools to access container functionality :

  • list containers
  • get logs from a container
  • start/stop a container
  • delete a container
  • inspect a container

The cli already has a serve command starting the grpc server.
We must package and ship the SDK for node js at least, and make it available for users

ACI : attach to log containers and tail logs

Currently we have an ACI command to fetch logs from a container.
ACI provides an API to specify a tail option to fetch a specified number of lines in the logs.
To follow logs, there is no streaming API, the az command line polls logs and rewrites the ouput every 2 secs.

  • add --follow option to attach to logs
  • add --tail option to tail logs

ACI : allow interactive run

At the moment we only allow run without specifying a command in the cmdline

Allow docker run ubuntu echo foo

ACI : azure login on windows is asking for windows firewall permissions on first execution

By default, windows firewall does not allow any .exe to open ports, which the azure login process does to interact with the browser. Once the user clicks "allow" this does not happen anymore, but we should use Desktop to configure properly the windows firwall and allow the aci backend binary to execute without warning. (Desktop already has/had some similar code to allow smb port for filesharing)

Pkg : update Desktop *for mac* packaging to include the new CLI next to the moby CLI and make sure it delegates properly when using default context

Desktop packaging needs to be updated to fetch this new CLI in addition to the moby one.
Desktop docker links (or PATH on windows) must point to this new CLI, and not to the moby one.
To ensure delegation works well, we will need to adjust how the shell out is performed (2 binaries in the same folder, with different binary names, or same names in different folders... )

ACI : allow using private images from hub

Take code from /docker/spiky to fetch hub login (if available) and send it with deployment info to allow hub private images in ACI.
Same for ACR registries (supporting tokens set by az acr login).

Pkg : update Desktop *for win* packaging to include the new CLI next to the moby CLI and make sure it delegates properly when using default context

Desktop packaging needs to be updated to fetch this new CLI in addition to the classic one.
Desktop docker PATH must point to this new CLI, and not to the classic one.
To ensure delegation works well, we will need to adjust how the shell out is performed (2 binaries in the same folder, with different binary names, or same names in different folders... )

ACI : run / rm output

docker run / docker rm command should output the container id that is created / deleted.
That should be used in e2e tests to execute a user flow

Release SDK packaging

  • Build full SDK (generated code and custom code for common operations : init, get contexts, ? )
  • make it available for download
  • ideally, publish this on a docker npm repo.
    @nebuk89 @justincormack any reason for not making the SDK public initially (before e disclose the MSFT partnership or before the new CLI is shipped with desktop)

Context management : docker context ls improvements

  • show current context with *
  • show default context that does not exist in store
  • I had some parsing errors when using old context from /docker/spiky. we might need to check why some unexpected context fail to read and make the code more robust (./bin/docker context ls:\nCommand stdout:\nunexpected end of JSON input\n\nstderr:\n\nerror:\nexit status 1)
  • show ACI resource group and location for ACI contexts

e2e tests are currently using the old cli to list context and check which is the default one, we meust update e2e to use the new CLI for this

ACI : interactive context create command

docker context create aci aci has flags for subscriptionID, resourcegroup & location. We need to also allow interactive creation like in /docker/spiky, and let the user select the resource group from a proposed list

Context management : add docker context rm

currently the new CLI only has context ls / context create command.
e2e test is using directly the old CLI in order to remove context, we must update e2e to run docker context rm on the new CLI

ACI : display exposed port/IP

when running docker run nginx -p 80:80, subsequent docker ps should display a PORTS column with the ACI public IP & port where we can connect to the deployed app.
(Code can be taken from /docker/spiky)

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.