Code Monkey home page Code Monkey logo

Comments (14)

kaos avatar kaos commented on June 14, 2024

The first option is the only viable long term option (or a similar solution, i.e. not environment based) as I see it. As otherwise machine ls will be misleading with regard to which one is currently the active one. Perhaps machine ought to look at DOCKER_HOST (or whatever other config option will be in the future) to determine the current active machine, to avoid confusion.

from machine.

bfirsh avatar bfirsh commented on June 14, 2024

Here is a previous proposal about how this could work: moby/moby#7232

from machine.

bfirsh avatar bfirsh commented on June 14, 2024

Here's a comment on that proposal explaining the requirements for Machine: moby/moby#7232 (comment)

from machine.

ehazlett avatar ehazlett commented on June 14, 2024

I think integration into Docker Engine would be best. However, I think to create a better user experience we should do the env vars config for the interim. This has bit me multiple times :)

from machine.

sthulb avatar sthulb commented on June 14, 2024

+1 for the env vars via machine config for now.

from machine.

sthulb avatar sthulb commented on June 14, 2024

However, it would perhaps be more advantageous for people to have this instead:

Zsh:

_machine_env_hook() {
  export DOCKER_HOST=$(machine url) DOCKER_AUTH=identity`
}
typeset -ag precmd_functions
if [[ -z $precmd_functions[(r)_machine_env_hook] ]]; then
  precmd_functions+=_machine_env_hook;
fi

Bash:

_machine_env_hook() {
  export DOCKER_HOST=$(machine url) DOCKER_AUTH=identity`
}
if ! [[ "$PROMPT_COMMAND" =~ _machine_env_hook ]]; then
  PROMPT_COMMAND="_machine_env_hook;$PROMPT_COMMAND";
fi

We could make machine config output that for now...

from machine.

bfirsh avatar bfirsh commented on June 14, 2024

If we're going to do machine config then I think that:

  1. it needs a better name that makes it clear that it's outputting a shell script
  2. it should just output export DOCKER_HOST=tcp://x.x.x.x:2376 DOCKER_AUTH=identity

from machine.

sthulb avatar sthulb commented on June 14, 2024

@bfirsh Firstly, perhaps config-shell

Secondly, if it just outputs an export, one would have to restart their shell for it to pick it up, creating the workflow of:

  1. machine create ...
  2. exit shell
  3. reopen shell
  4. docker run ...

from machine.

bfirsh avatar bfirsh commented on June 14, 2024

True.

I think we should aim to get Machine to automatically configure Docker. This is a hack which can use as a last resort.

from machine.

sthulb avatar sthulb commented on June 14, 2024

For that, we need docker to be changed to allow for your proposal from moby/moby#7232

from machine.

SvenDowideit avatar SvenDowideit commented on June 14, 2024

I'd propose $(machine shellinit) only because thats what boot2docker has had, so many users are used to it.

from machine.

ehazlett avatar ehazlett commented on June 14, 2024

For now, we are using the machine config command (not shell init as it just passes args to the Docker CLI and nothing in the environment) and swarm is doing the same. The long term solution is support in the engine.

from machine.

parabuzzle avatar parabuzzle commented on June 14, 2024

+1

Also, I may have created a duplicate (or augmentation) to this issue yesterday: #1416

from machine.

nathanleclaire avatar nathanleclaire commented on June 14, 2024

I am closing this issue as I think it's "as good as it's going to get" in Machine right now and further solutions would mandate support in Docker itself.

from machine.

Related Issues (20)

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.