-
Notifications
You must be signed in to change notification settings - Fork 1
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
Fix #518: Use redhat-docker intaller #522
Merged
Merged
Changes from 1 commit
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
cafbf3b
Fix #518: Use redhat-docker intaller
e-carlin b0a7c27
fix tests
e-carlin 227abf0
default flag changed
e-carlin 9eba037
fix indentation and test
e-carlin 9427d4f
Merge branch 'master' into 518-docker-installer
e-carlin 3d2f98b
installers are now split appart (setup vs install). rsconf does setup…
e-carlin 2a5fa8a
fix tests
e-carlin File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,74 +1,33 @@ | ||
#!/bin/bash | ||
_docker_pkg=docker-ce | ||
|
||
docker_install() { | ||
if [[ -e /var/lib/docker ]]; then | ||
# This will happen on dev systems only, but a good check nonetheless | ||
install_err '/var/lib/docker exists. You need to: | ||
systemctl stop docker | ||
systemctl disable docker | ||
rm -rf /var/lib/docker/* | ||
umount /var/lib/docker | ||
rmdir /var/lib/docker | ||
perl -pi -e "s{^/var/lib/docker.*}{}" /etc/fstab | ||
lvremove -f /dev/mapper/docker-vps | ||
|
||
Then re-run rsconf. This should only happen in development environments. | ||
' | ||
fi | ||
if rsconf_fedora_release_if 26; then | ||
# https://docs.docker.com/engine/installation/linux/docker-ce/fedora/#set-up-the-repository | ||
dnf -y install dnf-plugins-core | ||
dnf config-manager \ | ||
--add-repo \ | ||
https://download.docker.com/linux/fedora/"$_docker_pkg".repo | ||
else | ||
yum-config-manager \ | ||
--add-repo https://download.docker.com/linux/centos/"$_docker_pkg".repo | ||
yum makecache fast | ||
# yum-plugin-ovl required for overlay2 on centos7 | ||
# https://github.com/docker-library/official-images/issues/1291 | ||
rsconf_yum_install yum-plugin-ovl | ||
fi | ||
rsconf_yum_install "$_docker_pkg" | ||
{% if rsconf_db.channel == "dev" %} | ||
# Give vagrant user access in dev mode only | ||
usermod -aG docker vagrant | ||
{% endif %} | ||
} | ||
|
||
docker_main() { | ||
declare d={{ docker.data_d }}/volumes | ||
if [[ -e $d ]] && type docker >& /dev/null; then | ||
if docker_need_update; then | ||
if docker_up_to_date; then | ||
install_info "$d: exists, docker already installed" | ||
else | ||
# Need to specify cli explicitly or it won't update | ||
install_yum update "$_docker_pkg" "$_docker_pkg"-cli | ||
else | ||
install_info "$d: exists, docker already installed" | ||
fi | ||
else | ||
docker_install | ||
rsconf_radia_run_as_user root redhat-docker | ||
fi | ||
if docker_need_update; then | ||
if ! docker_up_to_date; then | ||
install_err "Installed docker=$(docker_version) is < min_software_version={{ docker.min_software_version }} after install." | ||
fi | ||
} | ||
|
||
docker_need_update() { | ||
local v=$(docker_version) | ||
docker_up_to_date() { | ||
declare v=$(docker_version) | ||
if [[ ! $v ]]; then | ||
install_err "docker --version did not output a valid version number" | ||
fi | ||
(( $(docker_version_num "$v" ) < $(docker_version_num '{{ docker.min_software_version }}') )) | ||
printf "%s\n%s\n" '{{ docker.min_software_version }}' "$v" | sort --version-sort --check &> /dev/null | ||
} | ||
|
||
docker_version() { | ||
if [[ $(docker --version) =~ ([0-9]+\.[0-9]+\.[0-9]+) ]]; then | ||
echo "${BASH_REMATCH[1]}" | ||
fi | ||
} | ||
|
||
docker_version_num() { | ||
declare dotted=$1 | ||
printf '%d%06d%06d' ${dotted//./ } | ||
} |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
gratuitous but came across this use of sort and thought it was nice.