Honor DOCKER_DEFAULT_PLATFORM with fetch-containers
#944
@ -14,6 +14,7 @@
|
|||||||
# along with this program. If not, see <http:#www.gnu.org/licenses/>.
|
# along with this program. If not, see <http:#www.gnu.org/licenses/>.
|
||||||
|
|
||||||
import click
|
import click
|
||||||
|
import os
|
||||||
from dataclasses import dataclass
|
from dataclasses import dataclass
|
||||||
import json
|
import json
|
||||||
import platform
|
import platform
|
||||||
@ -84,6 +85,11 @@ def _filter_for_platform(container: str,
|
|||||||
tag_list: List[str]) -> List[str] :
|
tag_list: List[str]) -> List[str] :
|
||||||
filtered_tags = []
|
filtered_tags = []
|
||||||
this_machine = platform.machine()
|
this_machine = platform.machine()
|
||||||
|
if "DOCKER_DEFAULT_PLATFORM" in os.environ:
|
||||||
|
this_machine = os.environ["DOCKER_DEFAULT_PLATFORM"].split("/")[-1]
|
||||||
|
if opts.o.debug:
|
||||||
|
print(f"DOCKER_DEFAULT_PLATFORM says the architecture is: {this_machine}")
|
||||||
|
else:
|
||||||
# Translate between Python and docker platform names
|
# Translate between Python and docker platform names
|
||||||
if this_machine == "x86_64":
|
if this_machine == "x86_64":
|
||||||
this_machine = "amd64"
|
this_machine = "amd64"
|
||||||
|
Loading…
Reference in New Issue
Block a user