Skip to content

CLI for Docker For Mac #882

Closed
Closed

Description

@nmcalabroso

CLI for Docker For Mac

Feature Request

Is it possible to have all the features that can be done via the GUI of Docker for Mac to some sort of CLI? This request is coming from an annoying issue from #412 that is holding back people who want to use their containers both for GNU/Linux and MacOS. Thank you!

Activity

  1. dsheets commented on Jan 16, 2017

    @dsheets
    Contributor

    #412 was resolved in Beta 33 and support was improved in Beta 35 or 36. Do you still need this functionality?

  2. quantonganh commented on Jan 19, 2017

    @quantonganh

    Do you still need this functionality?

    Yes, I still need this.

    Quoted from this: https://forums.docker.com/t/how-to-run-docker-for-mac-as-a-service-or-deamon/18728

    Expected behavior

    There should be a way to install Docker For Mac as a service which runs at system startup.

    Actual behavior

    Docker for Mac Beta seems to require a ui based app "Docker.app" to run in a graphical user session. I could not figure out any way on how to start the Docker environment using cli tools.
    The older Docker Toolbox allowed the use of e.g. docker-machine command to start its VirtualBox based environment. This allowed to create start-up scripts, to create a server ecosystem at system startup without a user to login.

    Information

    We'd like to use the great "Docker for Mac Beta" asap in a productive environment using the elegant integration with the native MacOS virtualization framework. So it would be of cause more robust and user friendly to install and run Docker and it's containers as system services automatically and independent on a user-login.
    I tried to find suitable CLI tools in the Docker.app package but haven't been successful.

    Is there any recommended way to install and run "Docker for Mac Beta" and its container as a service automatically at system startup?

  3. samoht commented on Jan 31, 2017

    @samoht
    Contributor

    There is no short-term plan to add a command-line interface to Docker for Mac, so closing as "won't fix" (at least in the short/middle term). We understand that this is an important component for some use-cases, but we have no plans to work on this currently.

  4. martinm82 commented on Aug 22, 2017

    @martinm82

    This is kind of insane. On one side you are developing a tool that is supposed to isolate apps/services and make it easy to deploy them everywhere but if it is about deploying the tool itself on a large number of macOS nodes than that is not supported and won't be.
    Right now I am using Ansible to deploy D4M on the nodes and need to pause Ansible in order to configure it manually.

    Any plans to make the D4M UI open source so that this feature could be contributed to you?

  5. martinm82 commented on Aug 23, 2017

    @martinm82
  6. lyndsey-ferguson commented on Jan 1, 2018

    @lyndsey-ferguson

    I really need to install Docker.app via the command line. sudo /Applications/Docker.app/Contents/MacOS/Docker --quit-after-install --unattended does not launch the tools needed. Unless I run the app by double clicking it in the GUI, docker ps complains about the daemon not running.

    I use ansible to set up many Mac minis for Continuous Integration and it is not reasonable that I have to log into each machine via VNC to get Docker to completely install.

  7. djs55 commented on Jan 1, 2018

    @djs55
    Contributor

    @lyndsey-ferguson the argument --quit-after-install shuts everything down after the installation. Try either removing this argument or re-launching the app using open /Applications/Docker.app (as a regular user i.e. without sudo) afterwards.

  8. lyndsey-ferguson commented on Jan 1, 2018

    @lyndsey-ferguson

    Thanks, I tried that but the Docker.app doesn't stops responding after a few seconds with 0% CPU activity. I left it running for 30 minutes with the thought that it was so busy that it was not responding on the main thread, but the "not responding" status (in the Activity Monitor app) did not change.

  9. lyndsey-ferguson commented on Jan 1, 2018

    @lyndsey-ferguson

    The problem was that, in my experimentation, I had started the /Library/LaunchDaemons/com.docker.vmnetd.plist LaunchDaemon. Unloading that allowed me to get this setup properly.

  10. martinm82 commented on Jan 2, 2018

    @martinm82

    So in my setup we need to have an open session (logged in) with a specific user.

    In order to properly configure Docker I need to run the app (with --quit-after-install --unattended) two times, once running as root user to configure properly the vmnetd daemon.
    Afterwards I need to re-run it but as the user that will be logged-in to configure the rest (settings for D4M like CPUs, memory, etc.).

    Configuring automatically additional mount points was as well not straight forward but after some time I figured out that the configuration itself is stored in a git repo (/Users/{{ docker_username }}/Library/Containers/com.docker.docker/Data/database/) in the following file /Users/{{ docker_username }}/Library/Containers/com.docker.docker/Data/database/com.docker.driver.amd64-linux/mounts.

    My custom launchd configuration as well looks a bit different:

    <?xml version="1.0" encoding="UTF-8"?>
    <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
    <plist version="1.0">
    <dict>
        <key>Label</key>
        <string>com.tomtom.docker</string>
        <key>ProgramArguments</key>
        <array>
          <string>/usr/bin/open</string>
          <string>-a</string>
          <string>/Applications/Docker.app</string>
          <string>--args</string>
          <string>--unattended</string>
        </array>
        <key>RunAtLoad</key>
        <true/>
    </dict>
    </plist>
    

    If I don't specify the additional args I get after a reboot always the welcome dialog and Docker won't start-up (even if I disable the welcome message in the settings.json.

  11. lyndsey-ferguson commented on Jan 2, 2018

    @lyndsey-ferguson

    Thanks @martinm82, I will use that if we experience the same issue.

  12. jensgreen commented on Jun 27, 2019

    @jensgreen

    We managed to do an unattended install that automatically starts the Docker daemon and launches it on login without the "We are whaly happy to have you" popup.

    Steps:

    • Install the Docker Desktop .dmg (we used 2.0.0.3)
    • Run /Applications/Docker.app/Contents/MacOS/Docker --quit-after-install --unattended as root
      • (unless: pgrep -q -f /Library/PrivilegedHelperTools/com.docker.vmnetd)
    • Set the following lines in~/Library/Group Containers/group.com.docker/settings.json:
      "displayedWelcomeMessage" : true,
      "displayedWelcomeWhale" : true,
      
    • Run /usr/bin/open -g -j -a /Applications/Docker.app
      • (unless: pgrep -q -f /Applications/Docker.app/Contents/MacOS/Docker)

    The Docker daemon is launched and starts up successfully after reboot.

  13. rfay commented on Jul 31, 2019

    @rfay

    As mentioned in #2359 (comment) the

    /Applications/Docker.app/Contents/MacOS/Docker --unattended
    /Applications/Docker.app/Contents/MacOS/Docker --quit-after-install --unattended
    

    doesn't work any more in Docker Desktop 2.1.0.0 (docker v19.03.1). Now you get the error message:

    DockerApplication: Docker.app starting for root
    Terminator: Running Docker Desktop as root is dangerous. Please run it as a regular user.
    

    Which breaks our CI :( For now, I can download earlier version, but Docker folk... please tell us how to do an unattended installation!

  14. docker-robott commented on Jun 21, 2020

    @docker-robott
    Collaborator

    Closed issues are locked after 30 days of inactivity.
    This helps our team focus on active issues.

    If you have found a problem that seems similar to this, please open a new issue.

    Send feedback to Docker Community Slack channels #docker-for-mac or #docker-for-windows.
    /lifecycle locked

  15. locked and limited conversation to collaborators on Jun 21, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions