-
Notifications
You must be signed in to change notification settings - Fork 161
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
ci: fix lxd vs docker connectivity issue
Running LXD and Docker on the same host has known connectivity issues. This caused CI failures when transitioning the GitHub action runner images from ubuntu-20.04 to ubuntu-24.04. The LXD documentation has a few recommended workarounds[1] and this one is the only one that worked well with GitHub CI. [1] https://documentation.ubuntu.com/lxd/en/latest/howto/network_bridge_firewalld/#prevent-connectivity-issues-with-lxd-and-docker
- Loading branch information
1 parent
d4c4dd4
commit 7a2dace
Showing
3 changed files
with
29 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
#!/bin/bash | ||
set -eux | ||
|
||
# The purpose of this script is to separate out the actions needed to setup | ||
# LXD on the GitHub Actions CI runners from the actual test setup and | ||
# execution. This way, test scripts can be mostly run locally without making | ||
# too many changes to the local system. | ||
|
||
# The runner images don't have lxd enabled by default. | ||
lxd init --auto | ||
|
||
# If the runner image uses docker, then work around a known connectivity issue | ||
# when using lxd and docker at the same time. | ||
# https://discuss.linuxcontainers.org/t/containers-do-not-have-outgoing-internet-access/10844/7 | ||
# https://documentation.ubuntu.com/lxd/en/latest/howto/network_bridge_firewalld/#prevent-connectivity-issues-with-lxd-and-docker | ||
if [ "active" == "$(systemctl is-active docker)" ] | ||
then | ||
iptables -I DOCKER-USER -i lxdbr0 -j ACCEPT | ||
iptables -I DOCKER-USER -o lxdbr0 -m conntrack --ctstate RELATED,ESTABLISHED -j ACCEPT | ||
# GitHub doesn't use IPV6 (yet?) | ||
# ip6tables -I DOCKER-USER -i lxdbr0 -j ACCEPT | ||
# ip6tables -I DOCKER-USER -o lxdbr0 -m conntrack --ctstate RELATED,ESTABLISHED -j ACCEPT | ||
fi |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters