Skip to content

Instantly share code, notes, and snippets.

@ljm42
Created September 1, 2019 16:38
Show Gist options
  • Save ljm42/74800562e59639f0fe1b8d9c317e07ab to your computer and use it in GitHub Desktop.
Save ljm42/74800562e59639f0fe1b8d9c317e07ab to your computer and use it in GitHub Desktop.
Temporary fix the Docker client for Unraid
#!/bin/bash
# Version 1.0
# Latest version of this script: https://gist.github.com/ljm42/74800562e59639f0fe1b8d9c317e07ab
# This script was tested on Unraid 6.7.2, although it will likely work in previous versions as well. It should not be needed in 6.8
# It will solve the problem reported here: https://forums.unraid.net/bug-reports/stable-releases/dockers-wanting-to-update-but-dont-in-the-end-r618/
# where due to changes in the Docker Hub API, the Unraid Docker client reported that certain Dockers needed to be updated.
# Thanks for @bluemonster for coming up with the fix!
# https://forums.unraid.net/bug-reports/stable-releases/dockers-wanting-to-update-but-dont-in-the-end-r618/page/2/?tab=comments#comment-5270
# This is meant to be run as a User Script, but it is just a bash file so you can run it however you like.
# Note that it has to be run after every reboot
# It is safe to run multiple times
### INSTALL ###
# Install the User Scripts plugin in Unraid, then Add New Script called "fix_docker_client"
# Hover over the script name and click Edit Script, paste the contents of this gist there, click Save Changes
# Set the schedule for this script to "At First Array Start Only", click Apply
# Click Run Script to run it once now
### TEST ###
# GO to the Docker tab and click Check For Updates. Any remaining items that say "apply update" actually need to be updated.
### UNINSTALL ###
# Disable the schedule or delete the script, then reboot to revert to stock Unraid
FILE=/usr/local/emhttp/plugins/dynamix.docker.manager/include/DockerClient.php
# disable globbing so can use * in variable
set -f
OLDTEXT="'Accept: .*',"
NEWTEXT="'Accept: application/vnd.docker.distribution.manifest.list.v2+json,application/vnd.docker.distribution.manifest.v2+json',"
sed -i "s@${OLDTEXT}@${NEWTEXT}@" ${FILE}
#grep "'Accept:" ${FILE}
echo "Changes complete. Go to the Docker tab and click 'Check For Updates'"
@nismanoke
Copy link

Thanx M8

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment