Skip to content
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

Proper way to install docker compose (v2) ? #1487

Open
EricSeastrand opened this issue Jun 21, 2023 · 8 comments
Open

Proper way to install docker compose (v2) ? #1487

EricSeastrand opened this issue Jun 21, 2023 · 8 comments
Labels

Comments

@EricSeastrand
Copy link

Describe the bug

Running docker compose yields an error: docker: 'compose' is not a docker command.

There doesn't seem to be a recent guide or "best practice" recommendation for how to install/use docker compose on Photon. Much of what I find is outdated - for the old docker-compose (v1) tool. Or involves manually downloading it (without any possibility for auto-update from a repo)

Unless I've done something wrong, the scope of this question is more about "what's the best way to do this?" than "make it work".

Reproduction steps

  1. Run tdnf install docker-compose - presumably installs using the SPEC file here. The setup completed with Installing/Updating: docker-compose-2.14.0-3.ph5.x86_64
  2. Run docker compose - see error docker: 'compose' is not a docker command.
  3. Run docker plugin list - see the list is empty

Expected behavior

Running tdnf install docker-compose should properly configure docker compose to where I can launch a container from a compose file.

Additional context

I just updated this Photon instance to v5 (was previously v3). Previously I was using the docker-compose (v1) tool. This is my first time trying to use the newer docker compose cli on this Photon. It's possible I did something wrong - though I always remember it being very manual to install docker compose.
Hoping this GH "Issue" can serve as learning for others who may be in the same situation.

@dcasota
Copy link
Contributor

dcasota commented Jun 21, 2023

Hi,

The docker-compose package in Ph5 installs /bin/docker-compose, actually with a version output Docker Compose version 2.14.0.

This isn't the same command as docker compose, indeed. Accordingly to https://github.com/docker/compose, For a smooth transition from legacy docker-compose 1.xx, please consider installing compose-switch to translate docker-compose ... commands into Compose V2's docker compose .... . Also check V2's --compatibility flag.

Please consider that there were Photon OS team voices, for example see #647, which weren't enthusiasts about docker compose at that time.

In addition, the docs in mind, an upgrade from Photon OS 3.0 to 5.0 is not officially supported (yet?).

For Photon OS 4.0, the upgrade workflow is described in https://vmware.github.io/photon/docs-v5/installation-guide/upgrading-to-photon-os-4/. Step 2 says, Stop any services (for example, docker) that are currently running in the VM. and After the upgrade, before you deploy into production, test all previous functionality to ensure that everything works as expected..

Hence, with respect to "what's the best way to do this?", I would consider to assess your containers that are affected by the upgrade, customize a solution and verify that the controls function properly.
Beside that, imho it is good to have reached out to the Photon OS team. Usually if there are enough "voices", they do consider enhancements, but it also can take a few weeks before you get a qualified answer.

Hope this helps.
-Daniel

@EricSeastrand
Copy link
Author

Thanks Daniel! Very helpful indeed.
Would it be correct to say that there's no "official" way to install docker compose on Photon at this time? I'm fine to install it as a one-off binary, but always try to avoid "veering off the beaten path" when there's a vendor-endorsed option.

Realizing "best" is highly subjective, to me it means: well-supported by the software vendor, such that I can automatically receive upstream updates as they release, and those updates have already been tested by the vendor/community to be compatible. Example: Ubuntu (and other distros) maintain their own repos of common packages, albeit with some lag-behind on releases to ensure compatibility.

If the Photon team is against doing something like that with docker compose, I can't fault them for that. I had assumed that they were [incorrectly, it seems], so I was looking for this "supported" solution.

In light of this, and given that I'm just a homelabber/VMWare enthusiast in a pseudo-production environment, it sounds like my best option is to install docker compose directly from Docker's own repo. Would you agree with that sentiment?

@dafanasiev
Copy link

Any news?

@dcasota
Copy link
Contributor

dcasota commented Jun 18, 2024

Sure. Simply install docker. For docker-compose I'm using the following code snippet from the docs.

DOCKER_CONFIG=${DOCKER_CONFIG:-$HOME/.docker}
mkdir -p $DOCKER_CONFIG/cli-plugins
curl -SL https://github.com/docker/compose/releases/download/v2.27.1/docker-compose-linux-x86_64 -o $DOCKER_CONFIG/cli-plugins/docker-compose
sudo chmod a+x $DOCKER_CONFIG/cli-plugins/docker-compose

Version from docker-compose package is 2.20.2 on x86_64.

image

@dafanasiev
Copy link

@dcasota I think that "proper way" means "use tdnf (because its rpm-based os), not hands"

@dcasota
Copy link
Contributor

dcasota commented Jun 18, 2024

Yes, it‘s really nice that tdnf is built-in in the internet versions of Photon OS. Same security awareness topics, robust, dependencies check for updates/upgrades, etc.
All latest&greatest bits from the internet but inter-pipeline-less are primarily to be taxed unsecure. Hence, there is a gap of 0-2 years to package managed versions.
Luckily, often, like in this case with docker-compose from the docs, the installation works flawlessly. 🍀

@WojciechThomas
Copy link

Why not:

sudo tdnf install  -y docker-compose
mkdir -p ~/.docker/cli-plugins
ln -s /usr/bin/docker-compose ~/.docker/cli-plugins/docker-compose
docker compose version

@dcasota
Copy link
Contributor

dcasota commented Oct 27, 2024

Hi, actually there seems a package gap to docker compose latest but as soon as it is a pretested automatic version bump for the open-source PhotonOS, yes, ‚why not’ is better.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

4 participants