├── .gitignore ├── renovate.json ├── CHANGELOG.md ├── package.json ├── README.md ├── com.docker.vmnetd.plist ├── action.yml ├── .github └── workflows │ └── ci.yaml └── lib └── setup-docker.js /.gitignore: -------------------------------------------------------------------------------- 1 | 2 | package-lock.json 3 | -------------------------------------------------------------------------------- /renovate.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": [ 3 | "config:base" 4 | ] 5 | } 6 | -------------------------------------------------------------------------------- /CHANGELOG.md: -------------------------------------------------------------------------------- 1 | # v1 2 | 3 | ## 1.0.1 4 | 5 | * support macOS https://github.com/docker/for-mac/issues/2359#issuecomment-607154849 6 | 7 | ## 1.0.0 8 | 9 | * nightly version use https://github.com/AkihiroSuda/moby-snapshot 10 | -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "setup-docker", 3 | "version": "1.0.0", 4 | "description": "", 5 | "main": "lib/setup-docker.js", 6 | "directories": { 7 | "lib": "lib" 8 | }, 9 | "dependencies": { 10 | "@actions/core": "^1.0.0", 11 | "@actions/exec": "^1.0.0" 12 | }, 13 | "devDependencies": {}, 14 | "scripts": { 15 | "test": "cross-env INPUT_DOCKER_VERSION='20.10' INPUT_DOCKER_CHANNEL=stable node lib/setup-docker", 16 | "test:noversion": "cross-env INPUT_DOCKER_VERSION='20.10' INPUT_DOCKER_CHANNEL=stable node lib/setup-docker" 17 | }, 18 | "author": "", 19 | "license": "ISC" 20 | } 21 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # setup-docker 2 | 3 | Support **Linux** and **macOS** 4 | 5 | **Example please see** 6 | 7 | * [ci.yaml](https://github.com/docker-practice/actions-setup-docker/blob/master/.github/workflows/ci.yaml) 8 | 9 | * [action.yml](https://github.com/docker-practice/actions-setup-docker/blob/master/action.yml) 10 | 11 | **Quick Start** 12 | 13 | ```yaml 14 | on: 15 | push 16 | 17 | name: ci 18 | 19 | jobs: 20 | ci: 21 | runs-on: ubuntu-latest 22 | steps: 23 | - uses: docker-practice/actions-setup-docker@master 24 | timeout-minutes: 12 25 | - run: | 26 | set -x 27 | 28 | docker version 29 | 30 | docker run --rm hello-world 31 | ``` 32 | -------------------------------------------------------------------------------- /com.docker.vmnetd.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Label 6 | com.docker.vmnetd 7 | Program 8 | /Library/PrivilegedHelperTools/com.docker.vmnetd 9 | ProgramArguments 10 | 11 | /Library/PrivilegedHelperTools/com.docker.vmnetd 12 | 13 | RunAtLoad 14 | 15 | Sockets 16 | 17 | Listener 18 | 19 | SockPathMode 20 | 438 21 | SockPathName 22 | /var/run/com.docker.vmnetd.sock 23 | 24 | 25 | Version 26 | 59 27 | 28 | 29 | -------------------------------------------------------------------------------- /action.yml: -------------------------------------------------------------------------------- 1 | # https://help.github.com/en/articles/metadata-syntax-for-github-actions 2 | 3 | name: 'setup-docker' 4 | description: 'Set up your GitHub Actions workflow with a specific version of Docker' 5 | author: 'khs1994' 6 | inputs: 7 | docker_version: 8 | description: Docker Version 9 | default: "24.0" 10 | required: false 11 | docker_nightly_version: 12 | # https://github.com/AkihiroSuda/moby-snapshot/releases 13 | description: Docker nightly Version 14 | default: snapshot-20210202 15 | required: false 16 | docker_channel: 17 | # https://download.docker.com/linux/ubuntu/dists/focal/pool/ 18 | description: Docker Channel 19 | default: stable 20 | # test 21 | # nightly # this channel use https://github.com/AkihiroSuda/moby-snapshot 22 | required: false 23 | docker_buildx: 24 | # https://docs.docker.com/engine/reference/commandline/buildx/ 25 | description: Enable Buildx 26 | default: true 27 | required: false 28 | docker_cli_experimental: 29 | # https://docs.docker.com/engine/reference/commandline/cli/#experimental-features 30 | description: docker cli experimental 31 | default: enabled 32 | required: false 33 | docker_daemon_json: 34 | # https://docs.docker.com/engine/reference/commandline/dockerd/#daemon-configuration-file 35 | description: /etc/docker/daemon.json 36 | default: | 37 | { 38 | "experimental": true 39 | } 40 | required: false 41 | runs: 42 | using: 'node20' 43 | main: 'lib/setup-docker.js' 44 | branding: 45 | icon: 'box' 46 | color: 'green' 47 | -------------------------------------------------------------------------------- /.github/workflows/ci.yaml: -------------------------------------------------------------------------------- 1 | on: 2 | push: 3 | pull_request: 4 | workflow_dispatch: 5 | schedule: 6 | - cron: '0 0 * * 4' 7 | 8 | name: CI 9 | 10 | jobs: 11 | docker: 12 | name: Docker 13 | defaults: 14 | run: 15 | shell: bash --noprofile --norc -exo pipefail {0} 16 | strategy: 17 | fail-fast: false 18 | matrix: 19 | docker_version: 20 | # - 18.09 21 | # - 19.03 22 | - "20.10" 23 | - "23.0" 24 | - "24.0" 25 | docker_channel: 26 | - stable 27 | - test 28 | # - nightly 29 | os: 30 | - ubuntu-20.04 31 | - ubuntu-22.04 32 | - ubuntu-latest 33 | - macos-13 34 | # - macos-13-xlarge 35 | include: 36 | # macOS 37 | - os: macos-latest 38 | docker_channel: stable 39 | docker_version: "20.10" 40 | runs-on: ${{ matrix.os }} 41 | # timeout-minutes: 20 42 | steps: 43 | - uses: actions/checkout@main 44 | with: 45 | fetch-depth: 2 46 | - uses: azure/docker-login@v1 47 | if: | 48 | github.event_name == 'push' 49 | with: 50 | # login-server: contoso.azurecr.io 51 | username: ${{ secrets.DOCKER_USERNAME }} 52 | password: ${{ secrets.DOCKER_PASSWORD }} 53 | - name: setup Docker 54 | uses: ./ 55 | # uses: docker-practice/actions-setup-docker@master 56 | with: 57 | docker_version: ${{ matrix.docker_version }} 58 | docker_channel: ${{ matrix.docker_channel }} 59 | - name: Setup tmate session 60 | uses: mxschmitt/action-tmate@master 61 | if: ${{ failure() }} 62 | timeout-minutes: 60 63 | - name: Test 64 | run: | 65 | # set -x 66 | docker version 67 | cat /etc/docker/daemon.json || true 68 | cat /Users/runner/.docker/daemon.json || true 69 | docker buildx version || true 70 | docker buildx ls || true 71 | 72 | docker-default: 73 | runs-on: ${{ matrix.os }} 74 | strategy: 75 | fail-fast: false 76 | matrix: 77 | os: 78 | - ubuntu-latest 79 | - macos-latest 80 | # timeout-minutes: 20 81 | defaults: 82 | run: 83 | shell: bash --noprofile --norc -exo pipefail {0} 84 | steps: 85 | - uses: actions/checkout@main 86 | with: 87 | fetch-depth: 2 88 | - name: setup docker(default) 89 | uses: ./ 90 | # uses: docker-practice/actions-setup-docker@master 91 | - name: Setup tmate session 92 | uses: mxschmitt/action-tmate@master 93 | if: ${{ failure() }} 94 | timeout-minutes: 60 95 | - run: docker version 96 | # Login docker hub or other docker registry 97 | # test docker login 98 | - uses: azure/docker-login@v1 99 | if: | 100 | github.event_name == 'push' 101 | with: 102 | # login-server: contoso.azurecr.io 103 | username: ${{ secrets.DOCKER_USERNAME }} 104 | password: ${{ secrets.DOCKER_PASSWORD }} 105 | # - name: docker login by cli 106 | # run: | 107 | # echo ${docker_password} | docker login -u ${docker_username} --password-stdin ${docker_registry:-} 108 | # if: | 109 | # github.event_name == 'push' 110 | # env: 111 | # # docker_registry: contoso.azurecr.io 112 | # docker_username: ${{ secrets.DOCKER_USERNAME }} 113 | # docker_password: ${{ secrets.DOCKER_PASSWORD }} 114 | - name: Build Docker Image 115 | run: | 116 | # set -x 117 | 118 | push= 119 | if [ "${push_image}" = 'true' ];then 120 | push='--push' 121 | fi 122 | 123 | echo 'FROM --platform=${TARGETPLATFORM} alpine' > Dockerfile 124 | echo 'RUN set -x ; apk add --no-cache curl' >> Dockerfile 125 | 126 | # fix macos docker auth 127 | sed -i "" 's/credsStore/_credsStore/g' ${DOCKER_CONFIG}/config.json || true 128 | 129 | tag=${version:-20.10}-${channel:-stable}-${os} 130 | docker buildx build \ 131 | -t khs1994/alpine:${tag} \ 132 | ${push} \ 133 | --platform linux/arm64,linux/amd64 \ 134 | . 135 | env: 136 | os: ${{ matrix.os }} 137 | # version: ${{ matrix.docker_version }} 138 | # channel: ${{ matrix.docker_channel }} 139 | push_image: ${{ github.event_name == 'push' }} 140 | 141 | # docker-nightly: 142 | # strategy: 143 | # fail-fast: false 144 | # matrix: 145 | # os: 146 | # - ubuntu-20.04 147 | # - ubuntu-22.04 148 | # - ubuntu-latest 149 | # runs-on: ${{ matrix.os }} 150 | # defaults: 151 | # run: 152 | # shell: bash --noprofile --norc -exo pipefail {0} 153 | # steps: 154 | # - uses: actions/checkout@main 155 | # with: 156 | # fetch-depth: 2 157 | # - uses: azure/docker-login@v1 158 | # if: | 159 | # github.event_name == 'push' 160 | # with: 161 | # # login-server: contoso.azurecr.io 162 | # username: ${{ secrets.DOCKER_USERNAME }} 163 | # password: ${{ secrets.DOCKER_PASSWORD }} 164 | # - name: setup docker 165 | # uses: ./ 166 | # # uses: docker-practice/actions-setup-docker@master 167 | # with: 168 | # docker_nightly_version: snapshot-20210202 169 | # docker_channel: nightly 170 | # - run: docker version 171 | 172 | notsupport-platform: 173 | strategy: 174 | fail-fast: false 175 | matrix: 176 | os: 177 | - windows-latest 178 | runs-on: ${{ matrix.os }} 179 | steps: 180 | - uses: actions/checkout@main 181 | with: 182 | fetch-depth: 2 183 | - name: setup docker(default) 184 | uses: ./ 185 | # uses: docker-practice/actions-setup-docker@master 186 | -------------------------------------------------------------------------------- /lib/setup-docker.js: -------------------------------------------------------------------------------- 1 | const exec = require('@actions/exec'); 2 | const core = require('@actions/core'); 3 | const os = require('os'); 4 | 5 | const DOCKER_VERSION = core.getInput('docker_version'); 6 | const DOCKER_CHANNEL = core.getInput('docker_channel'); 7 | const DOCKER_CLI_EXPERIMENTAL = core.getInput('docker_cli_experimental'); 8 | const DOCKER_DAEMON_JSON = core.getInput('docker_daemon_json'); 9 | const DOCKER_BUILDX = core.getInput('docker_buildx'); 10 | const DOCKER_NIGHTLY_VERSION = core.getInput('docker_nightly_version'); 11 | 12 | const systemExec = require('child_process').exec; 13 | 14 | let message; 15 | 16 | async function shell(cmd) { 17 | return await new Promise((resolve, reject) => { 18 | systemExec(cmd, function (error, stdout, stderr) { 19 | if (error) { 20 | reject(error); 21 | } 22 | 23 | if (stderr) { 24 | reject(stderr); 25 | } 26 | 27 | resolve(stdout.trim()); 28 | }); 29 | }); 30 | } 31 | 32 | async function buildx() { 33 | core.debug('set DOCKER_CLI_EXPERIMENTAL'); 34 | if (DOCKER_CLI_EXPERIMENTAL === 'enabled') { 35 | core.exportVariable('DOCKER_CLI_EXPERIMENTAL', 'enabled'); 36 | } 37 | 38 | if (DOCKER_BUILDX !== 'true') { 39 | core.info('buildx disabled'); 40 | 41 | return; 42 | } 43 | 44 | core.exportVariable('DOCKER_CLI_EXPERIMENTAL', 'enabled'); 45 | 46 | await exec.exec('docker', [ 47 | 'buildx', 48 | 'version', 49 | ]).then(async () => { 50 | // install buildx 51 | core.startGroup('setup qemu'); 52 | await exec.exec('docker', [ 53 | 'run', 54 | '--rm', 55 | '--privileged', 56 | 'ghcr.io/dpsigs/tonistiigi-binfmt:latest', 57 | "--install", 58 | "all" 59 | ]); 60 | core.endGroup(); 61 | 62 | core.startGroup('list /proc/sys/fs/binfmt_misc'); 63 | await exec.exec('ls -la', [ 64 | '/proc/sys/fs/binfmt_misc', 65 | ]).catch(() => { }); 66 | core.endGroup(); 67 | 68 | core.startGroup('create buildx instance'); 69 | await exec.exec('docker', [ 70 | 'buildx', 71 | 'create', 72 | '--use', 73 | '--name', 74 | 'mybuilder', 75 | '--driver', 76 | 'docker-container', 77 | '--driver-opt', 78 | // 'image=moby/buildkit:master' 79 | // moby/buildkit:buildx-stable-1 80 | 'image=ghcr.io/dpsigs/moby-buildkit:master' 81 | // $ docker pull moby/buildkit:master 82 | // $ docker tag moby/buildkit:master ghcr.io/dpsigs/moby-buildkit:master 83 | // $ docker push ghcr.io/dpsigs/moby-buildkit:master 84 | ]); 85 | core.endGroup(); 86 | 87 | core.startGroup('inspect buildx instance'); 88 | await exec.exec('docker', [ 89 | 'buildx', 90 | 'inspect', 91 | '--bootstrap' 92 | ]); 93 | core.endGroup(); 94 | }, () => { 95 | core.info('this docker version NOT Support Buildx'); 96 | }); 97 | } 98 | 99 | async function run() { 100 | const platform = os.platform(); 101 | 102 | if (platform === 'win32') { 103 | core.debug('check platform'); 104 | await exec.exec('echo', 105 | [`::error::Only Support Linux and macOS platform, this platform is ${os.platform()}`]); 106 | 107 | return 108 | } 109 | 110 | if (platform === 'darwin') { 111 | // macos 112 | if (os.arch() !== 'x64') { 113 | core.warning('only support macOS x86_64, os arch is ' + os.arch()); 114 | 115 | return; 116 | } 117 | 118 | core.exportVariable('DOCKER_CONFIG', '/Users/runner/.docker'); 119 | 120 | await exec.exec('docker', [ 121 | '--version']).catch(() => { }); 122 | 123 | await exec.exec('docker-compose', [ 124 | '--version']).catch(() => { }); 125 | 126 | core.startGroup('install docker') 127 | // await exec.exec('brew', ['update']) 128 | await exec.exec('wget', ['https://raw.githubusercontent.com/Homebrew/homebrew-cask/fe866ec0765de141599745f03e215452db7f511b/Casks/docker.rb']); 129 | // await exec.exec('wget', ['https://raw.githubusercontent.com/Homebrew/homebrew-cask/master/Casks/docker.rb']); 130 | await exec.exec('brew', [ 131 | 'install', 132 | '--cask', 133 | // DOCKER_CHANNEL !== 'stable' ? 'docker' : 'docker', 134 | 'docker.rb', 135 | ]); 136 | core.endGroup(); 137 | 138 | await exec.exec('mkdir', [ 139 | '-p', 140 | '/Users/runner/.docker' 141 | ]); 142 | 143 | await shell(`echo '${DOCKER_DAEMON_JSON}' | sudo tee /Users/runner/.docker/daemon.json`); 144 | 145 | core.startGroup('show daemon json content'); 146 | await exec.exec('cat', [ 147 | '/Users/runner/.docker/daemon.json', 148 | ]); 149 | core.endGroup(); 150 | 151 | core.startGroup('start docker step1'); 152 | // https://github.com/docker/for-mac/issues/2359#issuecomment-943131345 153 | await exec.exec('sudo', [ 154 | '/Applications/Docker.app/Contents/MacOS/Docker', 155 | '--unattended', 156 | '--install-privileged-components' 157 | ]); 158 | core.endGroup(); 159 | core.startGroup('start docker step2'); 160 | await exec.exec('open', [ 161 | '-a', 162 | '/Applications/Docker.app', 163 | '--args', 164 | '--unattended', 165 | '--accept-license' 166 | ]); 167 | core.endGroup(); 168 | core.startGroup('wait docker running'); 169 | await exec.exec('sudo', [ 170 | 'bash', 171 | '-c', 172 | ` 173 | set -x 174 | command -v docker || echo 'test docker command 1: not found' 175 | i=0 176 | while ! /Applications/Docker.app/Contents/Resources/bin/docker system info &>/dev/null; do 177 | (( i++ == 0 )) && printf %s '-- Waiting for Docker to finish starting up...' || printf '.' 178 | command -v docker || echo 'test docker command loop: not found' 179 | sleep 1 180 | # wait 180s(3min) 181 | if [ $i -gt 180 ];then exit 1;sudo /Applications/Docker.app/Contents/MacOS/com.docker.diagnose check;uname -a;system_profiler SPHardwareDataType;echo "::error::-- Wait docker start $i s too long, exit"; exit 1; fi 182 | done 183 | echo "::notice::-- Docker is ready.Wait time is $i s" 184 | uname -a || true 185 | system_profiler SPHardwareDataType || true 186 | `]); 187 | core.endGroup(); 188 | 189 | core.startGroup('docker version'); 190 | await exec.exec('docker', ['version']); 191 | core.endGroup(); 192 | 193 | core.startGroup('docker info'); 194 | await exec.exec('docker', ['info']); 195 | core.endGroup(); 196 | 197 | await core.group('set up buildx', buildx); 198 | 199 | return 200 | } 201 | 202 | message = 'check docker systemd status'; 203 | core.startGroup(message) 204 | await exec.exec('sudo', [ 205 | 'systemctl', 206 | 'status', 207 | 'docker', 208 | ]).then(() => { }).catch(() => { }); 209 | core.endGroup(); 210 | 211 | message = 'check docker version' 212 | core.debug(message); 213 | core.startGroup(message); 214 | await exec.exec('docker', [ 215 | 'version', 216 | ]).catch(() => { }); 217 | core.endGroup(); 218 | 219 | // if (DOCKER_CHANNEL === 'nightly') { 220 | // if (os.arch() !== 'x64') { 221 | // core.warning('nightly version only support x86_64, os arch is ' + os.arch()); 222 | 223 | // return; 224 | // } 225 | 226 | // core.exportVariable('DOCKER_CONFIG', '/home/runner/.docker'); 227 | 228 | // core.startGroup('download deb'); 229 | // await exec.exec('curl', [ 230 | // '-fsSL', 231 | // '-o', 232 | // '/tmp/moby-snapshot-ubuntu-focal-x86_64-deb.tbz', 233 | // `https://github.com/AkihiroSuda/moby-snapshot/releases/download/${DOCKER_NIGHTLY_VERSION}/moby-snapshot-ubuntu-focal-x86_64-deb.tbz` 234 | // ]); 235 | // core.endGroup(); 236 | 237 | // await exec.exec('sudo', [ 238 | // 'rm', 239 | // '-rf', 240 | // '/tmp/*.deb' 241 | // ]); 242 | 243 | // core.startGroup('unpack tbz file'); 244 | // await exec.exec('tar', [ 245 | // 'xjvf', 246 | // '/tmp/moby-snapshot-ubuntu-focal-x86_64-deb.tbz', 247 | // '-C', 248 | // '/tmp' 249 | // ]); 250 | // core.endGroup(); 251 | 252 | // core.startGroup('remove default moby'); 253 | // await exec.exec('sudo', [ 254 | // 'sh', 255 | // '-c', 256 | // "apt remove -y moby-buildx moby-cli moby-compose moby-containerd moby-engine moby-runc" 257 | // ]).catch(() => { }); 258 | // core.endGroup(); 259 | 260 | // core.startGroup('update apt cache'); 261 | // await exec.exec('sudo', [ 262 | // 'apt-get', 263 | // 'update', 264 | // ]).catch(() => { }); 265 | // core.endGroup(); 266 | 267 | // core.startGroup('install docker'); 268 | // await exec.exec('sudo', [ 269 | // 'sh', 270 | // '-c', 271 | // 'apt-get install -y /tmp/*.deb' 272 | // ]).catch(async () => { 273 | // core.endGroup(); 274 | 275 | // core.startGroup('install docker'); 276 | // await exec.exec('sudo', [ 277 | // 'sh', 278 | // '-c', 279 | // 'dpkg -i /tmp/*.deb' 280 | // ]); 281 | // core.endGroup(); 282 | // }); 283 | // core.endGroup(); 284 | 285 | // } else { 286 | core.exportVariable('DOCKER_CONFIG', '/home/runner/.docker'); 287 | 288 | core.debug('add apt-key'); 289 | await shell(` 290 | curl -fsSL https://download.docker.com/linux/ubuntu/gpg | gpg --dearmor | sudo sh -c 'cat >/usr/share/keyrings/docker-archive-keyring.gpg' 291 | `); 292 | 293 | message = 'add apt source'; 294 | core.debug(message); 295 | const UBUNTU_CODENAME = await shell('lsb_release -cs'); 296 | core.startGroup(message); 297 | await shell(` 298 | echo \ 299 | "deb [arch=amd64,arm64 signed-by=/usr/share/keyrings/docker-archive-keyring.gpg] https://download.docker.com/linux/ubuntu \ 300 | ${UBUNTU_CODENAME} ${DOCKER_CHANNEL}" | sudo tee /etc/apt/sources.list.d/docker.list > /dev/null 301 | `) 302 | core.endGroup(); 303 | 304 | message = 'update apt cache' 305 | core.debug(message); 306 | core.startGroup(message); 307 | await exec.exec('sudo', [ 308 | 'apt-get', 309 | 'update', 310 | ]).catch(() => { }); 311 | core.endGroup(); 312 | 313 | message = 'show available docker version'; 314 | core.debug(message); 315 | core.startGroup(message); 316 | await exec.exec('apt-cache', [ 317 | 'madison', 318 | 'docker-ce', 319 | '|', 320 | 'grep', 321 | `${DOCKER_VERSION}` 322 | ]); 323 | core.endGroup() 324 | 325 | const DOCKER_VERSION_STRING = await shell( 326 | `apt-cache madison docker-ce | grep ${DOCKER_VERSION} | head -n 1 | awk '{print $3}' | sed s/[[:space:]]//g`) 327 | 328 | if (!DOCKER_VERSION_STRING) { 329 | const OS = await shell( 330 | `cat /etc/os-release | grep VERSION_ID | cut -d '=' -f 2` 331 | ); 332 | 333 | core.warning(`Docker ${DOCKER_VERSION} not available on ubuntu ${OS}, will install latest docker version`); 334 | } 335 | 336 | core.startGroup('remove default moby'); 337 | await exec.exec('sudo', [ 338 | 'sh', 339 | '-c', 340 | "apt remove -y moby-buildx moby-cli moby-compose moby-containerd moby-engine moby-runc" 341 | ]).catch(() => { }); 342 | core.endGroup(); 343 | 344 | message = 'install docker' 345 | core.debug(message); 346 | core.startGroup(message); 347 | await exec.exec('sudo', [ 348 | 'apt-get', 349 | '-y', 350 | '--allow-downgrades', 351 | 'install', 352 | DOCKER_VERSION_STRING ? `docker-ce=${DOCKER_VERSION_STRING}` : 'docker-ce', 353 | DOCKER_VERSION_STRING ? `docker-ce-cli=${DOCKER_VERSION_STRING}` : 'docker-ce-cli' 354 | ]); 355 | 356 | await exec.exec('sudo', [ 357 | 'apt-get', 358 | '-y', 359 | 'install', 360 | 'docker-compose-plugin', 361 | ]).catch(() => { }); 362 | core.endGroup(); 363 | // } 364 | 365 | message = 'check docker version'; 366 | core.debug(message); 367 | core.startGroup(message); 368 | await exec.exec('docker', [ 369 | 'version', 370 | ]); 371 | core.endGroup(); 372 | 373 | message = 'check docker systemd status'; 374 | core.debug(message); 375 | core.startGroup(message); 376 | await exec.exec('sudo', [ 377 | 'systemctl', 378 | 'status', 379 | 'docker', 380 | ]); 381 | core.endGroup(); 382 | 383 | // /etc/docker/daemon.json 384 | core.debug('set /etc/docker/daemon.json'); 385 | core.startGroup('show default daemon json content_'); 386 | core.endGroup(); 387 | 388 | await shell(`echo '${DOCKER_DAEMON_JSON}' | sudo tee /etc/docker/daemon.json`); 389 | 390 | core.startGroup('show daemon json content'); 391 | await exec.exec('sudo', [ 392 | 'cat', 393 | '/etc/docker/daemon.json', 394 | ]); 395 | core.endGroup(); 396 | 397 | await exec.exec('sudo', [ 398 | 'systemctl', 399 | 'restart', 400 | 'docker', 401 | ]); 402 | 403 | await core.group('set up buildx', buildx); 404 | 405 | core.startGroup('docker info'); 406 | await exec.exec('docker', ['info']); 407 | core.endGroup(); 408 | } 409 | 410 | run().then(() => { 411 | console.log('Run success'); 412 | }).catch((e) => { 413 | core.setFailed(e.toString()); 414 | }); 415 | --------------------------------------------------------------------------------