docker-documentation/docs/images/docker-yq.md

9.2 KiB
Executable File

title
yq

linuxserver.io

Blog Discord Discourse Fleet GitHub Open Collective

The LinuxServer.io team brings you another container release featuring:

  • regular and timely application updates
  • easy user mappings (PGID, PUID)
  • custom base image with s6 overlay
  • weekly base OS updates with common layers across the entire LinuxServer.io ecosystem to minimise space usage, down time and bandwidth
  • regular security updates

Find us at:

  • Blog - all the things you can do with our containers including How-To guides, opinions and much more!
  • Discord - realtime support / chat with the community and the team.
  • Discourse - post on our community forum.
  • Fleet - an online web interface which displays all of our maintained images.
  • GitHub - view the source for all of our repositories.
  • Open Collective - please consider helping us by either donating or contributing to our budget

linuxserver/yq

GitHub Stars GitHub Release GitHub Package Repository GitLab Container Registry MicroBadger Layers Docker Pulls Docker Stars Jenkins Build

yq: Command-line YAML/XML processor - jq wrapper for YAML and XML documents. This image includes yq, jq, and xq.

Supported Architectures

Our images support multiple architectures such as x86-64, arm64 and armhf. We utilise the docker manifest for multi-platform awareness. More information is available from docker here and our announcement here.

Simply pulling linuxserver/yq should retrieve the correct image for your arch, but you can also pull specific arch images via tags.

The architectures supported by this image are:

Architecture Tag
x86-64 amd64-latest
arm64 arm64v8-latest
armhf arm32v7-latest

Usage

Docker cli

docker run --rm \
  -v "$PWD:$PWD" \
  -w="$PWD" \
  --entrypoint yq \
  linuxserver/yq \
  .foo.bar input.yml

You can replace the last line with any yq command and argument, which will be passed to yq inside the image.

docker run --rm \
  -v "$PWD:$PWD" \
  -w="$PWD" \
  --entrypoint jq \
  linuxserver/yq \
  .foo.bar input.json

You can replace the last line with any jq command and argument, which will be passed to jq inside the image.

docker run --rm \
  -v "$PWD:$PWD" \
  -w="$PWD" \
  --entrypoint xq \
  linuxserver/yq \
  .foo.bar input.xml

You can replace the last line with any xq command and argument, which will be passed to xq inside the image.

We provide a very convenient script that allows the yq container to run as if it was installed natively:

sudo curl -L --fail https://raw.githubusercontent.com/linuxserver/docker-yq/master/run-yq.sh -o /usr/local/bin/yq
sudo chmod +x /usr/local/bin/yq

Running these two commands on your docker host once will let you issue commands such as yq .foo.bar input.yml and the yq container will do its job behind the scenes.

sudo curl -L --fail https://raw.githubusercontent.com/linuxserver/docker-yq/master/run-jq.sh -o /usr/local/bin/jq
sudo chmod +x /usr/local/bin/jq

Running these two commands on your docker host once will let you issue commands such as jq .foo.bar input.json and the jq container will do its job behind the scenes.

sudo curl -L --fail https://raw.githubusercontent.com/linuxserver/docker-yq/master/run-xq.sh -o /usr/local/bin/xq
sudo chmod +x /usr/local/bin/xq

Running these two commands on your docker host once will let you issue commands such as xq .foo.bar input.xml and the xq container will do its job behind the scenes.

Docker Mods

Docker Mods

We publish various Docker Mods to enable additional functionality within the containers. The list of Mods available for this image (if any) can be accessed via the dynamic badge above.

Support Info

  • image version number
    • docker inspect -f '{{ index .Config.Labels "build_version" }}' linuxserver/yq

Updating Info

Via Docker Cli

  • Update the image: docker pull linuxserver/yq
  • You can also remove the old dangling images: docker image prune

Building locally

If you want to make local modifications to these images for development purposes or just to customize the logic:

git clone https://github.com/linuxserver/docker-yq.git
cd docker-yq
docker build \
  --no-cache \
  --pull \
  -t linuxserver/yq:latest .

The ARM variants can be built on x86_64 hardware using multiarch/qemu-user-static

docker run --rm --privileged multiarch/qemu-user-static:register --reset

Once registered you can define the dockerfile to use with -f Dockerfile.aarch64.

Versions

  • 19.09.22: - Rebase to Alpine 3.18, deprecate armhf.
  • 19.09.22: - Rebase to 3.17.
  • 19.09.22: - Rebase to 3.15.
  • 18.05.21: - Rebase to 3.13. add linuxserver wheel repo.
  • 09.10.20: - Fix run scripts evaluating $ in cases where they should not (ex: inside single quotes). Please rerun the Recommended method install/setup commands.
  • 07.10.20: - Initial Release.