├── README.md ├── scripts ├── Dockerfile-testInstall └── install_linux.sh └── CHANGELOG.md /README.md: -------------------------------------------------------------------------------- 1 | # The Docker Cloud Integration is now open source as part of the [Compose CLI](https://github.com/docker/compose-cli) 🎉 2 | You can read more here: https://www.docker.com/blog/open-source-cloud-compose/ -------------------------------------------------------------------------------- /scripts/Dockerfile-testInstall: -------------------------------------------------------------------------------- 1 | FROM ubuntu:latest 2 | 3 | RUN apt-get update 4 | RUN apt-get -y install curl grep 5 | RUN curl https://get.docker.com | sh 6 | 7 | COPY install_linux.sh /scripts/install_linux.sh 8 | RUN chmod +x /scripts/install_linux.sh 9 | RUN /scripts/install_linux.sh 10 | RUN docker version | grep Azure 11 | 12 | # check we can update 13 | RUN /scripts/install_linux.sh 14 | RUN docker version | grep Azure -------------------------------------------------------------------------------- /CHANGELOG.md: -------------------------------------------------------------------------------- 1 | # Changelog 2 | 3 | 25 | 26 | ## 0.1.7 - 2020-07-09 27 | 28 | ### New features 29 | 30 | * Support for docker logs -- follow to follow logs 31 | * docker run ... will attach to logs by default, if the user does not specify -d 32 | * Support for environment variables (#11) 33 | * Support for CPU/Memory limits (#7) 34 | 35 | ### Bug fixes 36 | 37 | * Login with azure multi-tenant accounts (#8) 38 | * Bug fixed deploying ACR images on Linux (#10) 39 | 40 | ## 0.1.4 - 2020-06-26 41 | 42 | First public beta release of the Docker CLI with 43 | [ACI](https://azure.microsoft.com/en-us/services/container-instances/) 44 | integration! 45 | 46 | This release includes: 47 | 48 | * Initial support for deploying containers and Compose applications to Azure Container Instances (ACI) 49 | * A gRPC API for managing contexts and Azure containers 50 | 51 | ### Known issues 52 | 53 | * Mapping a container port to a different host port is not supported in ACI (i.e.: `docker run -p 80:8080`). You can only expose the container port to the same port on the host. 54 | * Exec currently only allows interactive sessions with a terminal (`exec -t`), not specify commands in the command line. 55 | * `docker run` detaches from the container by default, even if `-d` is not specified. Logs can be seen later on with command `docker log `. 56 | * Replicas are not supported when deploying Compose application. One container will be run for each Compose service. Several services cannot expose the same port. 57 | * Name resolution between Compose services is done using the `/etc/hosts` file. If container code ignores `/etc/hosts`, the container will not be able to resolve other Compose services in the same application. 58 | * With an ACI context, Compose applications can be deployed with the new command `docker compose up`. The `docker-compose` command will fail if used with ACI contexts. The error message is not explicit and needs to be improved. 59 | * Windows containers are not supported on ACI in multi-container Compose applications. 60 | -------------------------------------------------------------------------------- /scripts/install_linux.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | # Script to install the Docker ACI integration CLI on Ubuntu (Beta). 4 | 5 | set -eu 6 | 7 | RELEASE_URL=https://api.github.com/repos/docker/aci-integration-beta/releases/latest 8 | LINK_NAME="${LINK_NAME:-com.docker.cli}" 9 | DRY_RUN="${DRY_RUN:-}" 10 | 11 | desktop_install_url="https://www.docker.com/products/docker-desktop" 12 | engine_install_url="https://docs.docker.com/get-docker/" 13 | 14 | link_path="/usr/local/bin/${LINK_NAME}" 15 | existing_cli_path="/usr/bin/docker" 16 | 17 | manual_install() { 18 | echo "Please follow the manual install instructions" 19 | } 20 | 21 | is_new_cli() { 22 | azure_version_str="$($1 version 2>/dev/null | grep 'Azure' || true)" 23 | if [ -n "$azure_version_str" ]; then 24 | echo 1 25 | else 26 | echo 0 27 | fi 28 | } 29 | 30 | echo "Running checks..." 31 | 32 | # Check OS 33 | if [ "$(command -v uname)" ]; then 34 | case "$(uname -s)" in 35 | "Linux") 36 | # Check for Ubuntu/Debian based distro 37 | if ! [ -f "/etc/lsb-release" ]; then 38 | echo "Warning: This script has been tested on Ubuntu and may not work on other distributions" 39 | fi 40 | # Pass 41 | ;; 42 | "Darwin") 43 | echo "Error: Script not needed on macOS, please install Docker Desktop Edge: $desktop_install_url" 44 | exit 1 45 | ;; 46 | "*") 47 | echo "Error: Unsupported OS, please follow manual instructions" 48 | exit 1 49 | ;; 50 | esac 51 | else 52 | # Assume Windows 53 | echo "Error: Script not needed on Windows, please install Docker Desktop Edge: $desktop_install_url" 54 | exit 1 55 | fi 56 | 57 | user="$(id -un 2>/dev/null || true)" 58 | sh_c='sh -c' 59 | sudo_sh_c='sh -c' 60 | if [ "$user" != 'root' ]; then 61 | if [ "$(command -v sudo)" ]; then 62 | sudo_sh_c='sudo -E sh -c' 63 | elif [ "$(command -v su)" ]; then 64 | sudo_sh_c='su -c' 65 | else 66 | echo "Error: This installer needs the ability to run commands as root." 67 | exit 1 68 | fi 69 | fi 70 | 71 | if [ -n "$DRY_RUN" ]; then 72 | sh_c='echo $sh_c' 73 | sudo_sh_c='echo $sudo_sh_c' 74 | fi 75 | 76 | # Check if Docker Engine is installed 77 | if ! [ "$(command -v docker)" ]; then 78 | echo "Error: Docker Engine not found" 79 | echo "You need to install Docker first: $engine_install_url" 80 | exit 1 81 | fi 82 | 83 | download_cmd='curl -fsSLo' 84 | # Check that system has curl installed 85 | if ! [ "$(command -v curl)" ]; then 86 | echo "Error: curl not found" 87 | echo "Please install curl" 88 | exit 1 89 | fi 90 | 91 | DOWNLOAD_URL=$(curl -s ${RELEASE_URL} | grep "browser_download_url.*docker-linux-amd64" | cut -d : -f 2,3) 92 | 93 | # Check if the ACI CLI is already installed 94 | if [ $(is_new_cli "docker") -eq 1 ]; then 95 | if [ $(is_new_cli "/usr/local/bin/docker") -eq 1 ]; then 96 | echo "You already have the Docker ACI Integration CLI installed, overriding with latest version" 97 | download_dir=$($sh_c 'mktemp -d') 98 | $sh_c "${download_cmd} ${download_dir}/docker-aci ${DOWNLOAD_URL}" 99 | $sudo_sh_c "install -m 775 ${download_dir}/docker-aci /usr/local/bin/docker" 100 | exit 0 101 | fi 102 | echo "You already have the Docker ACI Integration CLI installed, in a different location." 103 | exit 1 104 | fi 105 | 106 | # Check if this script has already been run 107 | if [ -f "${link_path}" ]; then 108 | echo "Error: This script appears to have been run as ${link_path} exists" 109 | echo "Please uninstall and rerun this script or follow the manual instructions" 110 | exit 1 111 | fi 112 | 113 | # Check current Docker CLI is installed to /usr/bin/ 114 | if ! [ -f "${existing_cli_path}" ]; then 115 | echo "Error: This script only works if the Docker CLI is installed to /usr/bin/" 116 | manual_install 117 | exit 1 118 | fi 119 | 120 | # Check that PATH contains /usr/bin and /usr/local/bin and that the latter is 121 | # higher priority 122 | path_directories=$(echo "${PATH}" | tr ":" "\n") 123 | usr_bin_pos=-1 124 | usr_local_bin_pos=-1 125 | count=0 126 | for d in ${path_directories}; do 127 | if [ "${d}" = '/usr/bin' ]; then 128 | usr_bin_pos=$count 129 | fi 130 | if [ "${d}" = '/usr/local/bin' ]; then 131 | usr_local_bin_pos=$count 132 | fi 133 | count=$((count + 1)) 134 | done 135 | if [ $usr_bin_pos -eq -1 ]; then 136 | echo "Error: /usr/bin not found in PATH" 137 | manual_install 138 | exit 1 139 | elif [ $usr_local_bin_pos -eq -1 ]; then 140 | echo "Error: /usr/local/bin not found in PATH" 141 | manual_install 142 | exit 1 143 | elif ! [ $usr_local_bin_pos -lt $usr_bin_pos ]; then 144 | echo "Error: /usr/local/bin is not ordered higher than /usr/bin in your PATH" 145 | manual_install 146 | exit 1 147 | fi 148 | 149 | echo "Checks passed!" 150 | echo "Downloading CLI..." 151 | 152 | # Download CLI to temporary directory 153 | download_dir=$($sh_c 'mktemp -d') 154 | $sh_c "${download_cmd} ${download_dir}/docker-aci ${DOWNLOAD_URL}" 155 | 156 | echo "Downloaded CLI!" 157 | echo "Installing CLI..." 158 | 159 | # Link existing Docker CLI 160 | $sudo_sh_c "ln -s ${existing_cli_path} ${link_path}" 161 | 162 | # Install downloaded CLI 163 | $sudo_sh_c "install -m 775 ${download_dir}/docker-aci /usr/local/bin/docker" 164 | 165 | # Clear cache 166 | cleared_cache=1 167 | if [ "$(command hash)" ]; then 168 | $sh_c "hash -r" 169 | elif [ "$(command rehash)" ]; then 170 | $sh_c "rehash" 171 | else 172 | cleared_cache= 173 | echo "Warning: Unable to clear command cache" 174 | fi 175 | 176 | if [ -n "$DRY_RUN" ]; then 177 | exit 0 178 | fi 179 | 180 | if [ -n "$cleared_cache" ]; then 181 | # Check ACI CLI is working 182 | if [ $(is_new_cli "docker") -eq 0 ]; then 183 | echo "Error: Docker ACI Integration CLI installation error" 184 | exit 1 185 | fi 186 | echo "Done!" 187 | else 188 | echo "Please log out and in again to use the Docker ACI integration CLI" 189 | fi 190 | --------------------------------------------------------------------------------