Compose: Encountered Syntax Error while installing Docker-Compose through pip in Ubuntu 14.04 server

Created on 17 Mar 2016  路  15Comments  路  Source: docker/compose

@ripcurl00d suggested me to post this here.

Environment Details:

VirtualBox
Networking through NAT (adapter 1) and intnet (adapter 2)

Docker Version:

Client:
version: 1.10.2

Server:
version: 1.10.2

I followed the below installation procedure of docker-compose

sudo apt-get update

sudo apt-get install python-pip

pip install docker-compose

docker-compose version

I am facing the below mentioned error while trying to check the installation docker-compose.

/usr/local/bin/docker-compose: line 1: syntax error near unexpected token 'newline'

/usr/local/bin/docker-compose: line: '<!DOCTYPE html>'


Has anyone encountered this error? How to resolve this?

_
PS: I also tried to install docker-composethrough curl . Still faced the same error

Most helpful comment

I think I have discovered what causes this, in case anyone else runs into it like myself and those listed here. dnephin might be right as well. However, If you copy and post the command for curl from the site and run it you will download the html page not the executable you need.

Don't run this:
curl -L https://github.com/docker/compose/releases/download/1.11.2/docker-compose-uname -s-uname -m -o /usr/local/bin/docker-compose

You need to replace 'uname -s' and 'uname -m'. Those are supposed to pull info about your kernel. That didn't work for me. So instead just put the file you need this:

curl -L https://github.com/docker/compose/releases/download/1.11.2/docker-compose-Linux-x86_64 -o /usr/local/bin/docker-compose

Then you will be good to go.

All 15 comments

I think your downloads are going through a proxy that sent you html instead of the binary you wanted. Use a text editor to look at what's in the file /usr/local/bin/docker-compose, and you'll see that it's not a binary.

@dnephin I have tried CentOS 7 instead of Ubuntu Trusty. I have installed Docker in CentOS. My observation- CentOS rocks!!! :100: It is simple. Smooth as a silk. Ubuntu is a bit complicated to handle.

install on ubuntu 14.04 and meet this problem, and i decide to download docker-compose file manually and move to /usr/local/bin/. and it's work.

I think I have discovered what causes this, in case anyone else runs into it like myself and those listed here. dnephin might be right as well. However, If you copy and post the command for curl from the site and run it you will download the html page not the executable you need.

Don't run this:
curl -L https://github.com/docker/compose/releases/download/1.11.2/docker-compose-uname -s-uname -m -o /usr/local/bin/docker-compose

You need to replace 'uname -s' and 'uname -m'. Those are supposed to pull info about your kernel. That didn't work for me. So instead just put the file you need this:

curl -L https://github.com/docker/compose/releases/download/1.11.2/docker-compose-Linux-x86_64 -o /usr/local/bin/docker-compose

Then you will be good to go.

@agoldenlife thanks, this solved my problem. I'm newer to docker/linux.

@ackris: Close the issue please.

Thanks, it solved my problem.

Try
sudo curl -L https://github.com/docker/compose/releases/download/1.19.0-rc2/docker-compose-Linux-x86_64 -o /usr/local/bin/docker-compose

If you are also using pip, try pip install docker-compose. This works for me on CentOS7.

Hi @dnephin @agoldenlife

I tried @agoldenlife suggestion, but it still downloaded a html file, and it said our _organization's security policy doesn't permit access to this site._

Is there any workaround for this issue? Or is it restricted to my organization's policy?

Regards
Aditya

but it still downloaded a html file, and it said our organization's security policy doesn't permit access to this site.

That message looks quite clear: your company doesn't allow it.

Have you asked inside your organization? If there was a workaround, you'd be violating your company's policy.

Hi @thaJeztah

Thanks for the quick response :)

We have raised a service request ticket with our IT admin team, and requested them to add docker-compose to safe standards list.

Regard

https://dl.bintray.com/docker-compose/master/
I solved it by downloading the file manually and pasting it in folder
/usr/local/bin
Note rename the file to docker-compose

@agoldenlife that worked for me!

sudo apt install docker-compose

or

sudo curl -L https://github.com/docker/compose/releases/download/1.11.2/docker-compose-Linux-x86_64 -o /usr/local/bin/docker-compose

worked for me

Was this page helpful?
0 / 5 - 0 ratings