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

feat: build the Docker Driver for arm64 #9247

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

tucksaun
Copy link

@tucksaun tucksaun commented Apr 23, 2023

What this PR does / why we need it:
Add ARM64 build and release of the Docker driver in Drone pipeline

Which issue(s) this PR fixes:
Fixes #5682

Special notes for your reviewer:
I would have loved to have a unified x64 and arm64 build but apparently Docker drivers does not support multi arch images. So instead I went with tweaking the build steps to allow cross building the image for ARM64 and added the instructions to do so in drone.yml.
It seems there's a drift in the images published on Docker Hub versus the one documented for use. I updated it here but this might be wrong.

Checklist

  • Reviewed the CONTRIBUTING.md guide (required)
  • Documentation added
  • Tests updated (no tests for this AFAIK)
  • CHANGELOG.md updated
  • Changes that require user attention or interaction to upgrade are documented in docs/sources/upgrading/_index.md

@tucksaun tucksaun requested review from JStickler and a team as code owners April 23, 2023 20:48
@CLAassistant
Copy link

CLAassistant commented Apr 23, 2023

CLA assistant check
All committers have signed the CLA.

@github-actions github-actions bot added the type/docs Issues related to technical documentation; the Docs Squad uses this label across many repositories label Apr 23, 2023
@tucksaun tucksaun force-pushed the docker-driver-amd64 branch 2 times, most recently from 20e05b7 to d9cac9a Compare April 23, 2023 20:52
@jeschkies
Copy link
Contributor

@tucksaun could you resolve the conflicts?

.drone/drone.yml Outdated
@@ -1500,6 +1500,7 @@ name: docker-driver
steps:
- commands:
- make docker-driver-push
- make docker-driver-push PLUGIN_ARCH=-arm64
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You have to change the jsonnet file uinstead. I'll generate the Drone YML then.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@jeschkies a friendly ping to let you know this PR has been rebased but requires your intervention for the .drone/drone.yml generation 🙂

@pull-request-size pull-request-size bot added size/S and removed size/M labels Sep 9, 2023
@tucksaun tucksaun force-pushed the docker-driver-amd64 branch 2 times, most recently from 1898680 to a1b1ecc Compare September 9, 2023 06:40
@tucksaun
Copy link
Author

tucksaun commented Sep 9, 2023

@jeschkies conflicts resolved

@guvmao
Copy link

guvmao commented Oct 5, 2023

Is there any issue preventing the advancement of this pull request?

@tucksaun
Copy link
Author

tucksaun commented Oct 5, 2023

Is there any issue preventing the advancement of this pull request?

there were new conflicts I just resolved. excluding those, I believe someone (@jeschkies?) has to regenerate the drone.yml now that the jsonnet file is updated.
and that's it?

@tucksaun tucksaun changed the title Build the Docker driver for arm64 build: build the Docker Driver for arm64 Jul 20, 2024
@tucksaun tucksaun changed the title build: build the Docker Driver for arm64 feat: build the Docker Driver for arm64 Jul 20, 2024
@tucksaun tucksaun force-pushed the docker-driver-amd64 branch 2 times, most recently from 5a31800 to f7c1227 Compare July 26, 2024 07:47
@jeschkies
Copy link
Contributor

@tucksaun I'm sorry. I've switched teams and have missed GitHub notifications.

I would have loved to have a unified x64 and arm64 build but apparently Docker drivers does not support multi arch images.

I was about to mentioned the multi arch image. How is the arm image tagged differently?

@tucksaun
Copy link
Author

tucksaun commented Aug 22, 2024 via email

@francescor
Copy link

Hi, I think your PR would be very helpful

is it a lot of work to solve conflicts to this PR can be accepted?

@tucksaun
Copy link
Author

tucksaun commented Oct 4, 2024

@francescor not much for the Dockerfile so this is done.

however this is a bit different for the pipeline because Drone has been recently removed (see #14273) and it seems like the docker plugin is neither build not released anymore (I can't find any reference to it anyway).

@jeschkies, this means I'm not able to update the pipeline for testing or releasing anymore 🤷

@francescor
Copy link

I see this one https://hub.docker.com/r/miacis/loki-docker-driver

is related to this context?

@tucksaun
Copy link
Author

tucksaun commented Oct 4, 2024

I see this one https://hub.docker.com/r/miacis/loki-docker-driver

is related to this context?

I have no idea

Copy link
Contributor

@jeschkies jeschkies left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We'd still have to pushblish the new image

@jeschkies
Copy link
Contributor

I'm fine with landing this but as I understand we would not be able to publish the ARM Docker image as it would override

@francescor
Copy link

Hi, we really badly need the ARM images, it will allow us to move all our setup into ARM with considerable savings :)
@tucksaun do you have the ARM image available? we may take it from you until this PM is solved
thanks

@tucksaun
Copy link
Author

I'm fine with landing this but as I understand we would not be able to publish the ARM Docker image as it would override

They should be built with different tags. The ARM version uses an explicit tag so this should not impact x64 users

@tucksaun
Copy link
Author

We'd still have to pushblish the new image

AFAICT the full releasing of the plugin needs to be restore

@tucksaun
Copy link
Author

Hi, we really badly need the ARM images, it will allow us to move all our setup into ARM with considerable savings :)

@tucksaun do you have the ARM image available? we may take it from you until this PM is solved

thanks

I didn't build it for a while (and bad timing as I'm away for conferences) but I can try to have a look in the coming days

@tucksaun
Copy link
Author

@francescor I just pushed the plugin at tucksaun/loki-docker-driver:main-arm64

please note I didn't have the opportunity to test it so this comes with no warranty 😁

@francescor
Copy link

lovely, thank you!

please note I didn't have the opportunity to test it so this comes with no warranty 😁

yes, of course :)

@francescor
Copy link

@francescor I just pushed the plugin at tucksaun/loki-docker-driver:main-arm64

forgive me, @tucksaun how do I pull your image?

docker pull ghcr.io/tucksaun/loki-docker-driver:main-arm64

@tucksaun
Copy link
Author

tucksaun commented Oct 11, 2024 via email

@francescor
Copy link

francescor commented Oct 14, 2024

thanks @tucksaun

I can install it

# drain node from swarm manager
$ docker node update --availability drain my_arm_node
# then, in that node
$ docker --version 
Docker version 26.1.4, build 5650f9b
$ docker plugin ls
ID        NAME      DESCRIPTION   ENABLED
$ docker ps 
CONTAINER ID   IMAGE     COMMAND   CREATED   STATUS    PORTS     NAMES

# install plugin
$ docker plugin install tucksaun/loki-docker-driver:main-arm64 --alias loki --grant-all-permissions
main-arm64: Pulling from tucksaun/loki-docker-driver
Digest: sha256:fb6b5790f298972624e01ab1bbee6e7a2eb1c4fdd8609426c65fd589d826750f
c4a9207ddf3d: Complete 
Installed plugin tucksaun/loki-docker-driver:main-arm64

but then apparently the "old" plugin keeps showing up :(

$ docker plugin ls 
ID             NAME          DESCRIPTION           ENABLED
2d6ac6b33590   loki:latest   Loki Logging Driver   true

and indeed, I still see that x86_64 emulator:

$ ps aux | grep x86_64-binfmt
root     3288290  3.8  1.2 1939332 202244 ?      Ssl  06:30   0:02 /usr/libexec/qemu-binfmt/x86_64-binfmt-P /bin/docker-driver /bin/docker-driver
root     3288337  0.0  0.0   6020  1920 pts/4    S+   06:31   0:00 grep --color=auto x86_64-binfmt

here the inspect (which correctly shows your plugin)

$ systemctl restart docker
$ docker plugin inspect loki
[
    {
        "Config": {
            "Args": {
                "Description": "",
                "Name": "",
                "Settable": null,
                "Value": null
            },
            "Description": "Loki Logging Driver",
            "DockerVersion": "27.2.0",
            "Documentation": "https://github.com/grafana/loki",
            "Entrypoint": [
                "/bin/docker-driver"
            ],
            "Env": [
                {
                    "Description": "Set log level to output for plugin logs",
                    "Name": "LOG_LEVEL",
                    "Settable": [
                        "value"
                    ],
                    "Value": "info"
                },
                {
                    "Description": "Activate pprof debugging endpoint for the given port.",
                    "Name": "PPROF_PORT",
                    "Settable": [
                        "value"
                    ],
                    "Value": ""
                }
            ],
            "Interface": {
                "Socket": "loki.sock",
                "Types": [
                    "docker.logdriver/1.0"
                ]
            },
            "IpcHost": false,
            "Linux": {
                "AllowAllDevices": false,
                "Capabilities": null,
                "Devices": null
            },
            "Mounts": null,
            "Network": {
                "Type": "host"
            },
            "PidHost": false,
            "PropagatedMount": "",
            "User": {},
            "WorkDir": "",
            "rootfs": {
                "diff_ids": [
                    "sha256:c4a9207ddf3d51da7effcf838f81641ef9c37d4861908f319bcc9e86bb767aa4"
                ],
                "type": "layers"
            }
        },
        "Enabled": true,
        "Id": "2d6ac6b33590d8cd13657347c1e0bdbfcc183ebc5937f2234ea3b50c10091164",
        "Name": "loki:latest",
        "PluginReference": "docker.io/tucksaun/loki-docker-driver:main-arm64",
        "Settings": {
            "Args": [],
            "Devices": [],
            "Env": [
                "LOG_LEVEL=info",
                "PPROF_PORT="
            ],
            "Mounts": []
        }
    }
]

@francescor
Copy link

The host is an AWS t4g.xlarge

# uname -a
Linux boat-worker-arm-1d15 6.2.0-1018-aws #18~22.04.1-Ubuntu SMP Wed Jan 10 22:31:58 UTC 2024 aarch64 aarch64 aarch64 GNU/Linux

with installed qemu-user-static & docker-buildx-plugin

If I remove it with apt purge qemu-user-static and then remove and reinstall the plugin, I cannot enable it

@tucksaun
Copy link
Author

@francescor I managed to reproduce the issue, I will try to have a look today or tomorrow

**What this PR does / why we need it**:
Add ARM64 build and release of the Docker driver in Drone pipeline

**Which issue(s) this PR fixes**:
Fixes grafana#5682

**Special notes for your reviewer**:
I would have loved to have a unified x64 and arm64 build but apparently Docker drivers does not support multi arch images.
So instead I went with tweaking the build steps to allow cross building the image for ARM64 and added the instructions to do so in `drone.yml`.

**Checklist**
- [x] Reviewed the [`CONTRIBUTING.md`](https://github.com/grafana/loki/blob/main/CONTRIBUTING.md) guide (**required**)
- [x] Documentation added
- [ ] Tests updated
- [ ] Changes that require user attention or interaction to upgrade are documented in `docs/sources/upgrading/_index.md`
@tucksaun
Copy link
Author

@francescor should be fixed

@francescor
Copy link

Super!

I confirm your loki image does not need x86_64-binfmt (so it can be removed: in Ubuntu 22.04 apt purge qemu-user-static)

thank you so much @tucksaun

I'll provide more feeds in case I hit issues, but I can see logs in our grafana, so it should be OK

Now we can definitively replace swarm node with ARM instances, with great savings!

Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
size/M type/docs Issues related to technical documentation; the Docs Squad uses this label across many repositories
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Docker Loki Driver ARM64
5 participants