How to upgrade docker-compose to latest version - docker-compose
I have installed docker-compose using the command
sudo apt install docker-compose
It installed docker-compose version 1.8.0 and build unknown
I need the latest version of docker-compose or at least a version of 1.9.0
Can anyone please let me know what approach I should take to upgrade it or uninstall and re-install the latest version.
I have checked the docker website and can see that they are recommending this to install the latest version'
sudo curl -L https://github.com/docker/compose/releases/download/1.21.0/docker-compose-$(uname -s)-$(uname -m) -o /usr/local/bin/docker-compose
But before that, I have to uninstall the present version, which can be done using the command
sudo rm /usr/local/bin/docker-compose
but this can be used only when the installation was done using curl. I am not sure if the installation was done by curl as I have used
sudo apt install docker-compose
Please let me know what should I do now to uninstall and re-install the docker-compose.
First, remove the old version:
If installed via apt-get
sudo apt-get remove docker-compose
If installed via curl
sudo rm /usr/local/bin/docker-compose
If installed via pip
pip uninstall docker-compose
Then find the newest version on the release page at GitHub or by curling the API and extracting the version from the response using grep or jq (thanks to dragon788, frbl, and Saber Hayati for these improvements):
# curl + grep
VERSION=$(curl --silent https://api.github.com/repos/docker/compose/releases/latest | grep -Po '"tag_name": "\K.*\d')
# curl + jq
VERSION=$(curl --silent https://api.github.com/repos/docker/compose/releases/latest | jq .name -r)
Finally, download to your favorite $PATH-accessible location and set permissions:
DESTINATION=/usr/local/bin/docker-compose
sudo curl -L https://github.com/docker/compose/releases/download/${VERSION}/docker-compose-$(uname -s)-$(uname -m) -o $DESTINATION
sudo chmod 755 $DESTINATION
The easiest way to have a permanent and sustainable solution for the Docker Compose installation and the way to upgrade it, is to just use the package manager pip with:
pip install docker-compose
I was searching for a good solution for the ugly "how to upgrade to the latest version number"-problem, which appeared after you´ve read the official docs - and just found it occasionally - just have a look at the docker-compose pip package - it should reflect (mostly) the current number of the latest released Docker Compose version.
A package manager is always the best solution if it comes to managing software installations! So you just abstract from handling the versions on your own.
If you tried sudo apt-get remove docker-compose and get E: Unable to locate package docker-compose, try this method :
This command must return a result, in order to check it is installed here :
ls -l /usr/local/bin/docker-compose
Remove the old version :
sudo rm -rf docker-compose
Download the last version (check official repo : docker/compose/releases) :
sudo curl -L "https://github.com/docker/compose/releases/download/1.24.0/docker-compose-$(uname -s)-$(uname -m)" -o /usr/local/bin/docker-compose
(replace 1.24.0 if needed)
Finally, apply executable permissions to the binary:
sudo chmod +x /usr/local/bin/docker-compose
Check version :
docker-compose -v
If the above methods aren't working for you, then refer to this answer: https://stackoverflow.com/a/40554985
curl -L "https://github.com/docker/compose/releases/download/1.22.0/docker-compose-$(uname -s)-$(uname -m)" > ./docker-compose
sudo mv ./docker-compose /usr/bin/docker-compose
sudo chmod +x /usr/bin/docker-compose
Based on #eric-johnson's answer, I'm currently using this in a script:
#!/bin/bash
compose_version=$(curl https://api.github.com/repos/docker/compose/releases/latest | jq .name -r)
output='/usr/local/bin/docker-compose'
curl -L https://github.com/docker/compose/releases/download/$compose_version/docker-compose-$(uname -s)-$(uname -m) -o $output
chmod +x $output
echo $(docker-compose --version)
it grabs the latest version from the GitHub api.
Here is another oneliner to install the latest version of docker-compose using curl and sed.
curl -L "https://github.com/docker/compose/releases/download/`curl -fsSLI -o /dev/null -w %{url_effective} https://github.com/docker/compose/releases/latest | sed 's#.*tag/##g' && echo`/docker-compose-$(uname -s)-$(uname -m)" -o /usr/local/bin/docker-compose && chmod +x /usr/local/bin/docker-compose
Do it in three steps. (showing for apt-get installs)
Uninstall the last one. e.g. for apt-get installs
sudo apt-get remove docker-compose
Install the new one (https://docs.docker.com/compose/install/)
sudo curl -L "https://github.com/docker/compose/releases/download/1.29.0/docker-compose-$(uname -s)-$(uname -m)" -o /usr/local/bin/docker-compose
and then
sudo chmod +x /usr/local/bin/docker-compose
Check your version
docker-compose --version
Simple Solution to update docker-compose
This will remove the existing binary of docker-compose and install a new version.
sudo cd /usr/local/bin && sudo rm -rf docker-compose
sudo sudo curl -SL https://github.com/docker/compose/releases/download/v2.2.3/docker-compose-linux-x86_64 -o /usr/local/bin/docker-compose
sudo chmod +x docker-compose
for the latest version visit https://github.com/docker/compose/releases and replace the latest one with v2.1.1
I was trying to install docker-compose on "Ubuntu 16.04.5 LTS" but after installing it like this:
sudo curl -L "https://github.com/docker/compose/releases/download/1.26.0/docker-compose-$(uname -s)-$(uname -m)" -o /usr/local/bin/docker-compose
I was getting:
-bash: /usr/local/bin/docker-compose: Permission denied
and while I was using it with sudo I was getting:
sudo: docker-compose: command not found
So here's the steps that I took and solved my problem:
sudo curl -L "https://github.com/docker/compose/releases/download/1.26.0/docker-compose-$(uname -s)-$(uname -m)" -o /usr/local/bin/docker-compose
sudo ln -sf /usr/local/bin/docker-compose /usr/bin/docker-compose
sudo chmod +x /usr/bin/docker-compose
use this from command line: sudo curl -L "https://github.com/docker/compose/releases/download/1.22.0/docker-compose-$(uname -s)-$(uname -m)" -o /usr/local/bin/docker-compose
Write down the latest release version
Apply executable permissions to the binary:
sudo chmod +x /usr/local/bin/docker-compose
Then test version:
$ docker-compose --version
If you installed with pip, to upgrade you can just use:
pip install --upgrade docker-compose
or as Mariyo states with pip3 explicitly:
pip3 install --upgrade docker-compose
Using latest flag in url will redirect you to the latest release of the repo
As OS name is lower case in github's filename, you should convert uname -s to lower case using sed -e 's/\(.*\)/\L\1/'.
sudo curl -L "https://github.com/docker/compose/releases/latest/download/docker-compose-$(uname -s|sed -e 's/\(.*\)/\L\1/')-$(uname -m)" -o /usr/local/bin/docker-compose && sudo chmod +x /usr/local/bin/docker-compose
On mac (also working on ubuntu):
sudo curl -L "https://github.com/docker/compose/releases/download/<release-version>/docker-compose-$(uname -s)-$(uname -m)" -o /usr/local/bin/docker-compose
sudo chmod +x /usr/local/bin/docker-compose
NOTE: write the as here:
https://github.com/docker/compose/releases
Use,
$ sudo curl -L "https://github.com/docker/compose/releases/download/1.24.0/docker-compose-$(uname -s)-$(uname -m)" -o /usr/local/bin/docker-compose && sudo chmod +x /usr/local/bin/docker-compose
$ docker-compose -v
Docker Engine and Docker Compose Plugin
Since Microsoft took over Docker they worked on porting docker-compose to their Docker Engine CLI plugins. For future support and updates I would recommend using docker compose plugin (Notice the missing dash) which can be install via the docker-compose-plugin package. The following instructions assume that you are using Ubuntu as Distro or any Distro thats using apt as package manager.
Installation Preparations
Update your mirrors:
sudo apt-get update
Make sure the following packages are installed:
sudo apt-get install \
ca-certificates \
curl \
gnupg \
lsb-release
After that add the official Docker GPG Key:
sudo mkdir -p /etc/apt/keyrings
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo gpg --dearmor -o /etc/apt/keyrings/docker.gpg
And finally add the the stable repository:
echo \
"deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/docker.gpg] https://download.docker.com/linux/ubuntu \
$(lsb_release -cs) stable" | sudo tee /etc/apt/sources.list.d/docker.list > /dev/null
Also make sure Docker Engine and other needed dependencies are installed:
sudo apt-get install docker-ce docker-ce-cli containerd.io
Installation of docker compose plugin
sudo apt-get install docker-compose-plugin
Any future updates of the plugin are easily applied via apt.
For further reference take a look at the official installation instructions of Docker Engine and Docker Compose.
After a lot of looking at ways to perform this I ended up using jq, and hopefully I can expand it to handle other repos beyond Docker-Compose without too much work.
# If you have jq installed this will automatically find the latest release binary for your architecture and download it
curl --silent "https://api.github.com/repos/docker/compose/releases/latest" | jq --arg PLATFORM_ARCH "$(echo `uname -s`-`uname -m`)" -r '.assets[] | select(.name | endswith($PLATFORM_ARCH)).browser_download_url' | xargs sudo curl -L -o /usr/local/bin/docker-compose --url
On ubuntu desktop 18.04.2, I have the 'local' removed from the path when using the curl command to install the package and it works for me. See above answer by Kshitij.
In my case, using Windows + WSL2 with Ubuntu 20.04, was necessary only this:
sudo apt update
and then:
sudo apt upgrade
Centos/RHEL
Follow my answer below if you're using Centos7 with an x86-64 architecture. This answer is also available in my github.
Stop Your Docker Containers
I noticed other answers did not talk about stopping your docker containers/images instances before attempting to upgrade gracefully. Assumptions are inevitable but can be costly. Onward we go!
Options to update Docker-Compose
There are 2 options to upgrade docker-compose if you first downloaded and installed docker-compose using the Curl command.
Using Curl, jq package, and Github's direct URL to the docker-compose repository.
Using Curl, Sed, and Github's direct URL to the docker-compose repository.
Note: some of the commands below require "sudo" privileges.
Demonstration
The script below was saved to a file called "update_docker_compose.sh". You need to give this file executable permissions.
Like so:
chmod +x update_docker_compose.sh
"docker_docker_compose.sh" file content:
#!/bin/bash
# author: fullarray (stackoverflow user)
# Contribution shared on: stackoverflow.com
# Contribution also available on: github.com
# date: 06112022
# Stop current docker container running
docker stop containerID
# Remove current docker network running
docker rm containerID
# Remove image of target application(s)
docker image rm imageID
# Delete either dangling (unatagged images) docker containers or images or network
docker system prune -f
# This step depends on the jq package.
# Uncomment jq package installation command below if using Centos7 x86-64.
# sudo yum install jq
# Declare variable to get latest version of docker-compose from github repository
compose_version=$(curl https://api.github.com/repos/docker/compose/releases/latest | jq .name -r)
# Declare variable to target installation directory
target_install_dir='/usr/local/bin/docker-compose'
# Get OS and build (assumes Linux Centos7 and x86_64)
get_local_os_build=$(uname -s)-$(uname -m)
# Execute curl command to carry download and installation operation
curl -L https://github.com/docker/compose/releases/download/$compose_version/docker-compose-$get_local_os_build -o $target_install_dir
# Use chmod to modify permissions to target installation directory (to make it executable)
chmod +x $target_install_dir
# Print docker-compose version to terminal to verify upgrade
$(docker-compose --version)
Edit the script with variables specific to your environment
The script above has a few variables you need to edit with values specific to your docker environment. For instance, you need to replace container ID and image ID with the values that the following commands output.
docker ps
and
docker images output
Once you finalize creating the file (including the edits). Switch to the directory that contains the file. For example, if you created the file in /home/username/script/update_docker_compose.sh
cd /home/username/script
Last, run the script by executing the following
./update_docker_compose.sh
Option 2
Create a script file name "update_docker_compose.sh"
Edit the file and add the following content:
#!/bin/bash
# author: fullarray (stackoverflow user)
# Contribution shared on: stackoverflow.com
# Contribution also available on: github.com
# date: 06112022
# Stop current docker container running
docker stop containerID
# Remove current docker network running
docker rm containerID
# Remove image of target application(s)
docker image rm imageID
# Delete either dangling (unatagged images) docker containers or images or network
docker system prune -f
# Declare variable to target installation directory
target_install_dir='/usr/local/bin/docker-compose'
# Get OS and build (assumes Linux Centos7 and x86_64)
get_local_os_build=$(uname -s)-$(uname -m)
# Execute curl and sed command to carry out download and installation operation
# compose_latest_version=$(curl -L "https://github.com/docker/compose/releases/download/`curl -fsSLI -o /dev/null -w %{url_effective} https://github.com/docker/compose/releases/latest | sed 's#.*tag/##g' && echo`/docker-compose-$get_local_os_build") -o $target_install_dir
# Use chmod to modify permissions to target installation directory (to make it executable)
chmod +x $target_install_dir
# Print docker-compose version to terminal to verify upgrade
$(docker-compose --version)
Edit the script with variables specific to your environment
The script above also has a few variables you need to edit with values specific to your docker environment. For instance, you need to replace container ID and image ID with the values that the following commands output.
docker ps
and
docker images output
Once you finalize creating the file (including the edits). Switch to the directory that contains the file. For example, if you created the file in /home/username/script/update_docker_compose.sh
cd /home/username/script
Last, run the script by executing the following
./update_docker_compose.sh
This is the method of installing docker compose version 2.12.x
Update debian package manager
# apt-get update
# apt-get install docker-compose-plugin
Then install the plugin manualy
DOCKER_CONFIG=${DOCKER_CONFIG:-$HOME/.docker}
mkdir -p $DOCKER_CONFIG/cli-plugins
curl -SL https://github.com/docker/compose/releases/download/v2.12.2/docker-compose-linux-x86_64 -o $DOCKER_CONFIG/cli-plugins/docker-compose
Give permisson of execution of file
chmod +x $DOCKER_CONFIG/cli-plugins/docker-compose
Last test the installation
docker compose version
// Docker Composer Version v2.12.2
If you have homebrew you can also install via brew
$ brew install docker-compose
This is a good way to install on a Mac OS system
Most of these solutions are outdated or make you install old version.
To install the latest
sudo apt install jq
DOCKER_COMPOSE_VERSION=$(curl --silent https://api.github.com/repos/docker/compose/releases/latest | jq .name -r)
sudo curl -L "https://github.com/docker/compose/releases/download/$DOCKER_COMPOSE_VERSION/docker-compose-$(uname -s)-$(uname -m)" -o /usr/local/bin/docker-compose
sudo chmod +x /usr/local/bin/docker-compose
Well, my case was pretty weird. I am using wsl2, and Docker Desktop (Windows 11). I stop getting this error after rename the folder "docker" to "config-dev-server" and update de Dockerfile like this this:
COPY ./docker/apache/apache2.conf /etc/apache2/apache2.conf
to
COPY ./config-dev-server/apache/apache2.conf /etc/apache2/apache2.conf
With a newer Docker Desktop for Mac 3.3.0, you don't need to install Docker Compose as a seperate package. Docker Compose comes as a first class citizen installed with Docker by default. Check out the below CLI:
docker compose version
Docker Compose version 2.0.0-beta.1%
Related
PowerShell Core in Debian Docker Container Error
I'm new to Docker and am trying to create a Docker image with Raspbian base and PowerShell Core installed. EDIT: Updated Dockerfile to include libicu52 package, which resolved the main error: lack of libpsl-native or dependencies not available. Changed CMD parameters and now have a different error. Here is my Dockerfile: # Download the latest RPi3 Debian image FROM resin/raspberrypi3-debian:latest # Update the image and install prerequisites RUN apt-get update && apt-get install -y \ wget \ libicu52 \ libunwind8 \ && apt-get clean # Grab the latest tar.gz RUN wget https://github.com/PowerShell/PowerShell/releases/download/v6.0.0-rc.2/powershell-6.0.0-rc.2-linux-arm32.tar.gz # Make folder to put PowerShell RUN mkdir ~/powershell # Unpack the tar.gz file RUN tar -xvf ./powershell-6.0.0-rc.2-linux-arm32.tar.gz -C ~/powershell # Run PowerShell CMD pwsh -v New error: hostname: you must be root to change the host name /bin/sh: 1: pwsh: not found How do I resolve these errors? Thanks in advance!
Instead of downloading from source and extracting it in your container, I'd recommend using the official apt installer packages for your Dockerfile from Microsoft's official Debian repository as described at: https://learn.microsoft.com/en-us/powershell/scripting/setup/installing-powershell-core-on-macos-and-linux?view=powershell-6#debian-9 So transforming that to Dockerfile format: # Install powershell related system components RUN apt-get install -y \ gnupg curl apt-transport-https \ && apt-get clean # Import the public repository GPG keys RUN curl https://packages.microsoft.com/keys/microsoft.asc | sudo apt-key add - # Register the Microsoft's Debian repository RUN sh -c 'echo "deb [arch=amd64] https://packages.microsoft.com/repos/microsoft-debian-stretch-prod stretch main" > /etc/apt/sources.list.d/microsoft.list' # Install PowerShell RUN apt-get update \ && apt-get install -y \ powershell # Start PowerShell CMD pwsh Alternatively you can also try to start from one of the original Microsoft docker Linux images, but of course then you need to solve then the raspberry installation for yourself: https://hub.docker.com/r/microsoft/powershell/tags/
Eclipse Che Google Cloud Compute Engine
Having challenges running Eclipse Che multiuser mode on Google Cloud computer engine instance. Environment (che cli): 6.1.0 - using docker 17.03.2-ce / native Input: docker run -it -e CHE_MULTIUSER=true -e CHE_HOST={server-ip} -v /var/run/docker.sock:/var/run/d ocker.sock -v {localuserfolder}:/data eclipse/che start Output: INFO: (che start): Starting containers... docker_compose --file="/data/instance/docker-compose-container.yml" -p="che" up -d >> "/data/cli.log" 2>&1 che_postgres_1 is up-to-date ERROR: for che Container "4a245b40b556" is unhealthy. ERROR: for keycloak Container "4a245b40b556" is unhealthy. Encountered errors while bringing up the project. ERROR: Error during 'compose up' - printing 30 line tail of {localuserfolder}/cli.log: Noticed issue has something do to with postgres not having permission to run some scripts: docker container logs che_postgres_1 /usr/bin/container-entrypoint: line 3: exec: /var/lib/pgsql/init-che-user-and-run.sh: cannot execute: Permission denied /usr/bin/container-entrypoint: line 3: /var/lib/pgsql/init-che-user-and-run.sh: Permission denied Documented fix doesn't work, :/data is already mounted to read/writable directory.
Probably Google Cloud overrides file system permissions somehow. Have you tried mounting different dirs into :/data?
I've tested your command and it works in my case by using a GCP instance with Debian 9 and docker 17.12, here is the steps that I've followed: 1) install docker $ sudo apt-get install apt-transport-https ca-certificates curl gnupg2 software-properties-common $ curl -fsSL https://download.docker.com/linux/$(. /etc/os-release; echo "$ID")/gpg | sudo apt-key add - $ sudo add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/$(. /etc/os-release; echo "$ID") $(lsb_release -cs) stable" $ sudo apt-get install docker-ce 2) run che, I've used as a directory the /tmp, I recommend you to create another directory to store the files $ sudo docker run -it -e CHE_MULTIUSER=true -e CHE_HOST=INTERNAL-IP -v /var/run/docker.sock:/var/run/docker.sock -v /DIRECTORY_WITH_PERMISSIONS:/data eclipse/che start
Not all pre-reqs install correctly for Hyperledger Composer
I've been following the Hyperledger Composer tutorial. I managed to install Ubuntu 16.04 on Hyper-V on my Windows 10 Enterprise. I then started on the following pre-req installation instructions: https://hyperledger.github.io/composer/installing/installing-prereqs.html I ran the prereqs-ubuntu.sh script. It ran fine with no errors. I examined the logs and saw that it had successfully installed npm 5.6.0, node 8.9.4, docker 17.12.x, docker composer 1.13.x, and Python 2.7.12. However, when I run run $ sudo npm --version it tells me that the npm command is not found Same with $ sudo node --version Not found...?! Why would that be when the log clearly shows that npm and node where successfuly installed?!
Well, what I did and managed through: --> install nodejs and npm: sudo snap install node --classic --channel=8 so you get the latest node8. --> then to solve "sudo" problem with node specify the npm prefix: npm config set prefix ~/.node_modules add the following to .bash_profile export PATH=$HOME/.node_modules/bin:$PATH Now the packages will install into your user directory and no permissions will be harmend. --> install nvm (to get exactly node 8.9 version on the next step): curl -o- https://raw.githubusercontent.com/creationix/nvm/v0.33.11/install.sh | bash or wget -qO- https://raw.githubusercontent.com/creationix/nvm/v0.33.11/install.sh | bash Verify: node -v nvm which should output 'nvm' if the installation was successful. --> get and set node 8.9 version: nvm install v8.9.0 nvm use 8.9.0 --> reset PATHs: echo export PATH="$HOME/npm/bin:$PATH" >> ~/.bashrc npm config set prefix ~/npm echo "export NODE_PATH=$NODE_PATH:/home/$USER/npm/lib/node_modules" >> ~/.bashrc && source ~/.bashrc --> at this stage the docker previous setup shall be destroyed: docker kill $(docker ps -q) docker rm $(docker ps -aq) docker rmi $(docker images dev-* -q) --> Installing the rest of prereqs: sudo apt-add-repository -y ppa:git-core/ppa sudo apt-get update # install git sudo apt-get install -y git # Ensure that CA certificates are installed sudo apt-get -y install apt-transport-https ca-certificates # Add Docker repository key to APT keychain curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add - # Update package lists sudo apt-get update # Verifies APT is pulling from the correct Repository sudo apt-cache policy docker-ce # Install Docker echo "# Installing Docker" sudo apt-get -y install docker-ce # Add user account to the docker group sudo usermod -aG docker $(whoami) # Install docker compose echo "# Installing Docker-Compose" sudo curl -L "https://github.com/docker/compose/releases/download/1.13.0/docker-compose-$(uname -s)-$(uname -m)" \ -o /usr/local/bin/docker-compose sudo chmod +x /usr/local/bin/docker-compose # Install unzip, required to install hyperledger fabric. sudo apt-get -y install unzip --> now you can install Fabric dev. env. (assuming the rest of prereq components stand available): npm install -g composer-cli etc.
I think you need to log out and close the shell. And then restart with the new session, as the shell stores your session. Also, after installation, the use of sudo is not recommended as mentioned on IBM hyperledger website.
Version in "./docker-compose.yml" is unsupported. You might be seeing this error because you're using the wrong Compose file version
Here's my docker-compose.yml file: version: '3.1' services: a: image: tutum/hello-world b: image: tutum/hello-world secrets: id: my_password If I run $ docker-compose-up I get this: Version in "./docker-compose.yml" is unsupported. You might be seeing this error because you're using the wrong Compose file version. My docker-compose version: $ docker-compose --version docker-compose version 1.11.0, build 6de1806 What's wrong here? Shouldn't my docker-compose version support v3.1 of the docker-compose.yml specification (according to the release notes, it does) ?
You are doing everything right and it should work. But there was a bug in docker-compose 1.11.0 which not recognized file format 3.1 as valid. (3.0 works). There is already a new release of docker-compose (1.11.1) which includes the bugfix: Bugfixes Fixed a bug where the 3.1 file format was not being recognized as valid by the Compose parser So I would recommend to upgrade your docker-compose version if you want to use file format 3.1. At the moment the safest way to upgrade docker-compose is by deleting it and reinstalling it. rm /usr/local/bin/docker-compose Reinstall: curl -L https://github.com/docker/compose/releases/download/1.11.1/docker-compose-`uname -s`-`uname -m` > /usr/local/bin/docker-compose chmod +x /usr/local/bin/docker-compose docker-compose --version docker-compose version 1.11.1, build 7c5d5e4 Now there isn't an error anymore on the file format. (I did not test with your .yml). docker-compose up Starting compose_a_1 Starting compose_b_1
I have resolved the issue by upgrading docker-compose. Follwed below steps to upgrade docker-compose in ubuntu16.04 step1: $which docker-compose /usr/bin/docker-compose step2: $sudo rm /usr/bin/docker-compose step3: curl -L https://github.com/docker/compose/releases/download/1.20.0/docker-compose-`uname -s`-`uname -m` -o /usr/bin/docker-compose step4: chmod +x /usr/bin/docker-compose
If your file version is 3.7 and you get the following error: ERROR: Version in "./config.yml" is unsupported. You might be seeing this error because you're using the wrong Compose file version. Either specify a supported version (e.g "2.2" or "3.3") and place your service definitions under the `services` key, or omit the `version` key and place your service definitions at the root of the file to use version 1. Here is the solution: Remove current binary sudo apt-get remove docker-compose OR sudo rm /usr/local/bin/docker-compose Download the binary sudo curl -L "https://github.com/docker/compose/releases/download/1.29.2/docker-compose-$(uname -s)-$(uname -m)" -o /usr/local/bin/docker-compose. You can find the current latest version here (1.29.1 as of writing). Allow execution sudo chmod +x /usr/local/bin/docker-compose Remove old link sudo rm /usr/bin/docker-compose, make new link sudo ln -s /usr/local/bin/docker-compose /usr/bin/docker-compose I hope this resolves the issue.
To get the latest version of docker-compose : sudo apt remove docker-compose curl -L https://github.com/docker/compose/releases/download/1.28.4/docker-compose-`uname -s`-`uname -m` -o /usr/bin/docker-compose sudo chmod +x /usr/bin/docker-compose
If using linux/ubuntu, This is maybe obvious but be careful you run as root e.g. docker-compose -v Gives docker-compose version 1.8.0, build unknown vs sudo docker-compose -v Gives docker-compose version 1.17.1, build 6d101fb Also make sure docker-compose and docker-machine are up to date as #lvthillo states
try uninstall old version and reinstall. sudo apt remove docker-compose sudo curl -L "https://github.com/docker/compose/releases/download/1.22.0/docker-compose-$(uname -s)-$(uname -m)" -o /usr/local/bin/docker-compose sudo chmod +x /usr/local/bin/docker-compose reboot should print out docker-compose --version docker-compose version 1.22.0, build 1719ceb
I had done docker-compose --version prior to implementing lvthillo's solution and I was still getting outdated versions showing up. It turned out I needed to flush the hash list my bash shell was holding onto. hash -r ... hope that is useful for someone else
We cant able to tell you without watching the particular error firstly check it with by running this command docker build . when you got the error then search it in google in my case it was the permission error when i tried it with sudo it worked. Hope it will help you
As #Ivthillo said, you need to upgrade to version 1.11.1. You should first remove the current version file sudo rm -f ${which docker-compose} then install 1.11.1 version sudo curl -L "https://github.com/docker/compose/releases/download/1.11.1/docker-compose-$(uname -s|sed -e 's/\(.*\)/\L\1/')-$(uname -m)" -o /usr/local/bin/docker-compose and give execution permission to it sudo chmod +x /usr/local/bin/docker-compose Notice: for installing latest version you can use below command sudo curl -L "https://github.com/docker/compose/releases/latest/download/docker-compose-$(uname -s|sed -e 's/\(.*\)/\L\1/')-$(uname -m)" -o /usr/local/bin/docker-compose
On osx 10.12.6 sierra Steps for v1.22 or higher I had a specific issue/incompatibility where I did not want to completely upgrade docker. I am stuck currently on docker 17.06.0-ce-mac18. So I merely wanted to upgrade docker-compose and nothing else. My steps: Identify location of docker-compose: which docker-compose Identify docker-compose version: docker-compose --version = docker-compose version 1.14.0, build c7bdf9e backup previous docker-compose?: mv /usr/local/bin/docker-compose /usr/local/bin/docker-compose-bak replace with curl -L https://github.com/docker/compose/releases/download/1.22.0/docker-compose-`uname -s`-`uname -m` > /usr/local/bin/docker-compose if you need to determine the latest version just check https://github.com/docker/compose/releases and replace version above with latest. verify version: docker-compose --version = docker-compose version 1.22.0, build f46880f
I solved it by making sure my new code aligns with the rest of the code. It appears as it needs to have a certain format and if it's misaligned in regards to the rest of the code it won't see the 'Valid top-level sections for this Compose file are: version, services, networks, volumes, secrets, configs, and extensions starting with "x-".'
Try with "sudo" sudo docker-compose up
You don't need to uninstall docker or remove anything. If you get an error similar to the following when running docker-compose up: Version in "./docker-compose.yml" is unsupported. You might be seeing this error because you're using the wrong Compose file version. Either specify a supported version (e.g "2.2" or "3.3")... you can just modify the version specified in your docker-compose file version: '3.1' # change to version '3.3' services: a: image: tutum/hello-world b: image: tutum/hello-world secrets: id: my_password and run docker-compose up again.
The issue was caused by too low version of docker-compose = 1.25.0, which is unfortunately the highest version Ubuntu supports on any of their current releases, including focal (20.04LTS), groovy (20.10) and hirsute. Upgraded docker-compose the official docker/non-Debian-way: $ sudo curl -L "https://github.com/docker/compose/releases/download/1.27.4/docker-compose-$(uname -s)-$(uname -m)" -o /usr/local/bin/docker-compose $ sudo chmod +x /usr/local/bin/docker-compose $ which docker-compose /usr/local/bin/docker-compose $ docker-compose -v docker-compose version 1.27.4, build 40524192 Reference
unable to install haproxy 1.5 on centos 6.5
I am trying to install haproxy on my centos 6.5 server. I am using the command yum install haproxy This command installs a version 1.4.x. I have also looked at the following links, but could not get it to work http://virtuallyhyper.com/2013/05/configure-haproxy-to-load-balance-sites-with-ssl/ http://blog.haproxy.com/2012/09/10/how-to-get-ssl-with-haproxy-getting-rid-of-stunnel-stud-nginx-or-pound/ https://github.com/bluerail/haproxy-centos how do i install it?
You can build the RPM as follows: mkdir -p rpmbuild/{BUILD,RPMS,SOURCES,SPECS,SRPMS} sudo yum -y install pcre-devel openssl-devel cd rpmbuild/SOURCES curl -L -O http://www.haproxy.org/download/1.5/src/haproxy-1.5.3.tar.gz tar zxf haproxy-1.5.3.tar.gz cd .. cp -p SOURCES/haproxy-1.5.3/examples/haproxy.spec SPECS/haproxy153.spec sed -i 's/Release: .*/Release: %{?_release:%{_release}}%{!?_release:1}/' SPECS/haproxy153.spec sed -i 's/USE_PCRE=1 /USE_PCRE=1 USE_OPENSSL=1 USE_ZLIB=1 /' SPECS/haproxy153.spec rpmbuild --define "_topdir `pwd`" --define "_release 2" -bb SPECS/haproxy153.spec (I use a local directory and set the release number otherwise it is the same as http://qiita.com/uemura/items/e822c1ed505b9fe0208f) Install scp RPMS/x86_64/haproxy-1.5.3-2.x86_64.rpm root#somewhere:~/ somewhere# yum localinstall ~/haproxy-1.5.3-2.x86_64.rpm
You could install from source using one of these tar bundles: http://www.haproxy.org/download/1.5/src/ You will probably need to install the following bundles to compile from source: yum openssl-devel pcre-devel make gcc Here's also a script which I presume would work on your environment