Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Running the 'docker' command from run-on-arch #33

Closed
marco-brandizi opened this issue Mar 9, 2021 · 5 comments
Closed

Running the 'docker' command from run-on-arch #33

marco-brandizi opened this issue Mar 9, 2021 · 5 comments

Comments

@marco-brandizi
Copy link

marco-brandizi commented Mar 9, 2021

I'd like to test my multiple-architecture Docker image, hence, I've tried the run-on-arch action, together with the docker command. Something like this:

name: Docker Test
on:
  workflow_dispatch
jobs:
  build:
    runs-on: ubuntu-latest
    steps:
    - name: Code checkout
      uses: actions/checkout@v2.3.4
    
    - uses: uraimo/run-on-arch-action@v2.0.9
      name: Run aratiny
      id: docker-cmd
      env:
        DOCKER_USER: ${{secrets.DOCKER_USER}}
        DOCKER_PASSWORD: ${{secrets.DOCKER_PASSWORD}}
      with:
        arch: aarch64
        distro: ubuntu20.04
        run: |
          cd docker
          ./docker-run.sh # this just sets up a few options and runs "docker run".

However, I get the error 'docker command not found':

Status: Downloaded newer image for arm64v8/ubuntu:20.04
 ---> 0a1fc7bf1e73
Step 2/3 : COPY ./run-on-arch-install.sh /root/run-on-arch-install.sh
 ---> 24140215138a
Step 3/3 : RUN chmod +x /root/run-on-arch-install.sh && /root/run-on-arch-install.sh
Warning: rning] The requested image's platform (linux/arm64) does not match the detected host platform (linux/amd64) and no specific platform was requested
 ---> Running in 85e80b14444c
Removing intermediate container 85e80b14444c
 ---> 833ef66bca6f
Successfully built 833ef66bca6f
Successfully tagged run-on-arch-rothamsted-knetminer-docker-test-aarch64-ubuntu20-04:latest
WARNING: The requested image's platform (linux/arm64) does not match the detected host platform (linux/amd64) and no specific platform was requested


export MAVEN_ARGS=" --no-transfer-progress --batch-mode --no-snapshot-updates -Pdocker"
++ docker run -it -p 8080:8080 --env MAVEN_ARGS knetminer/knetminer:latest aratiny
./docker-run.sh: line 144: docker: command not found
Error: The process '/home/runner/work/_actions/uraimo/run-on-arch-action/v2.0.9/src/run-on-arch.sh' failed with exit code 127

Details here.

Usually, the docker command is available in the GH Actions host, without anything special to set, here it seems it isn't.

Moreover, as I asked elsewhere, I'm not sure that I should prepare multi-arch images for all the parents that my image uses, or if doing it just for the latter is enough.

@uraimo
Copy link
Owner

uraimo commented Mar 10, 2021

These images we use have the bare minimum inside (even the apt cache have been stripped), so you'll have to run a "apt update;apt ugrade" and "apt install docker-ce docker-ce-cli containerd.io" or variations to install docker.
Once done, docker should work I suppose.

@marco-brandizi
Copy link
Author

Thanks. @uraimo, I'll try it. So, you mean, there isn't a default Docker image that it's used by all the builds and all the actions add up to it?

@uraimo
Copy link
Owner

uraimo commented Mar 11, 2021

Exactly, no single docker image since the OS Distro is different and depending on the arch you choose.
You can take a look at the actual image being used for every os/arch combination here.
But one thing that is common to all of them is that to reduce the size of the image, all of them are stripped of any cache or content that can be automatically downloaded again. For example the apt cache.
In you case, consider these image to be as minimal as possible, so every thing you need you'll need to install it (for example docker, that should be 300Mb or so).

@marco-brandizi
Copy link
Author

Thanks, what I actually meant is that I was assuming there is an image that can be set at the beginning of the config file and that GH Actions uses for all the build steps and actions. Instead, it seems that every action can set up its own image.

@uraimo
Copy link
Owner

uraimo commented Mar 16, 2021

Yes exactly, every step is independent and defines a new emulated context that has its lifetime limited to the step you are in. The step following a run-on-arch one starts back in the default amd64 enviroment.

@uraimo uraimo closed this as completed Mar 21, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants