-
Notifications
You must be signed in to change notification settings - Fork 2
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
Upgrade to docker compose@v2 #32
Conversation
fi | ||
|
||
# Create alias for docker-compose to call docker compose | ||
echo 'docker compose "$@"' | $SUDO tee /usr/local/bin/docker-compose > /dev/null |
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.
I believe this will take care of overwriting/ uninstalling the native installations created on line 187 of the previous version.
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.
We can run into a case where the docker compose plugin and the old docker-compose script are both installed. In this case, we need to make sure to uninstall the old docker-compose script and create the alias. We will need to add a new return code in check_docker.sh
for this case. I believe the existing catch in install_docker.sh
for non-zero return codes will handle this appropriately.
In particular, running yum deplist docker-ce-cli
shows that Centos7 will install the docker-compose plugin whenever docker is installed.
docker/install_docker.sh
Outdated
# Install docker-compose-plugin | ||
if [ -s /etc/redhat-release ] && grep -iq 'release 7\|release 8' /etc/redhat-release ; then | ||
# TODO: add silencing flags | ||
$SUDO yum update |
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.
There is a TODO here already marking this change, but I'm leaving a note here to track it in the PR review.
We need to pass -q -y
here.
docker/install_docker.sh
Outdated
if [ ! -e /usr/bin/docker-compose ]; then | ||
$SUDO ln -s /usr/local/bin/docker-compose /usr/bin/docker-compose | ||
fi | ||
|
||
$SUDO chown "$USER":"$USER" /home/"$USER"/.docker -R |
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.
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.
I tested the latest changes on a raspberry pi (arm64) device which had the old docker-compose installed via pip, and I tested the changes on a centos7 (x86) device which had the old docker-compose installed as a native binary alongside the docker compose plugin. Both tests went well.
There is one cosmetic bug I noticed, but that should be a quick fix-up. Other than that, I say this is good to go.
docker/check_docker-compose.sh
Outdated
@@ -21,6 +22,11 @@ if ! docker compose version > /dev/null 2>&1 ; then | |||
exit 4 | |||
fi | |||
|
|||
# verify that docker compose & docker-compose aren't both installed | |||
if docker-compose version | grep '^docker-compose .* [0-9][0-9]*\.[0-9][0-9]*\.[0-9][0-9]*' ; then |
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.
This check will print out to the cli. I believe we want to add a -q
to the grep command.
Changes:
check_docker.sh
to check forv20.10.13
as the minimum installed version. This version introduced the inclusion of thedocker-compose-plugin
repo, which is the easiest way to installdocker compose
check_docker-compose.sh
to check for a minimum version of2.0
and uses thedocker compose version
command instead of an alias/potentially targetingdocker-compose
install_docker.sh
to:python3-pip
docker-compose
pip
packageapt
/yum
packages (needed after installingdocker 20.10.13
)docker-compose-plugin
docker-compose
todocker compose