Error on 'docker-compose up -d
Closed this issue · 20 comments
Following instructions, using default docker-compose.yml file, receive the following error:
ERROR: 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") 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.
For more on the Compose file format versions, see https://docs.docker.com/compose/compose-file/
Which version should it be? In the file, it is listed as 3.7.
Thanks for any help!
Docker version 18.09.4, build d14af54266
Have you edited the docker-compose.yml at all? If so could you please post the contents?
I haven't edited anything in the docker-compose.yml file, but here it is just in case something else went wrong:
version: "3.7"
volumes:
xbs-db-data:services:
db:
container_name: "xbs-db"
environment:
- "MONGO_INITDB_DATABASE=xbrowsersync"
- "MONGO_INITDB_ROOT_PASSWORD=$XBS_DB_PASSWORD"
- "MONGO_INITDB_ROOT_USERNAME=$XBS_DB_USERNAME"
image: "mongo:4.0.4"
labels:
- "traefik.enable=false"
networks:
- "xbs-net"
restart: "always"
volumes:
- "xbs-db-data:/data/db"
- "./mongoconfig.js:/docker-entrypoint-initdb.d/mongoconfig.js"
api:
container_name: "xbs-api"
depends_on:
- "db"
environment:
- "XBROWSERSYNC_DB_PWD=$XBS_DB_PASSWORD"
- "XBROWSERSYNC_DB_USER=$XBS_DB_USERNAME"
image: "xbrowsersync/api:1.1.6"
labels:
- "traefik.frontend.rule=Host:$XBS_API_HOSTNAME"
- "traefik.port=8080"
networks:
- "xbs-net"
restart: "always"
volumes:
- "./settings.json:/usr/src/api/config/settings.json"
reverse-proxy:
command: "--api --docker"
container_name: "xbs-reverse-proxy"
depends_on:
- "api"
image: traefik:1.7.5-alpine
labels:
- "traefik.enable=false"
networks:
- "xbs-net"
ports:
- "443:443"
- "80:80"
restart: "always"
volumes:
- "/var/run/docker.sock:/var/run/docker.sock"
- "./acme.json:/acme.json"
- "./traefik.toml:/traefik.toml"networks:
xbs-net:
I updated acme.json, traefik.toml, and .env as instructed. Otherwise, everything should be as downloaded from here.
Thanks for your help!
Hmm, could you run docker-compose --version
and paste the results please?
docker-compose version 1.17.1, build unknown
Thanks for the quick response on this, by the way!
What platform are you on? Win/Mac/Linux? And version?
Linux. Ubuntu 18.04 on a Digital Ocean droplet.
Linux 4.15.0-47-generic #50-Ubuntu SMP Wed Mar 13 10:44:52 UTC 2019 x86_64 x86_64 x86_64 GNU/Linux
New droplet or old one? Have previous version of docker/docker-compose been installed on this droplet?
It's a new droplet and I just installed both docker and docker-compose today, but it's got a few other docker containers on it (gitea, turtl, and shaarli) that I installed ahead of xbrowsersync. It has npm and mongodb installed outside of docker, as well. I'm not using them, yet, though. I can spin up another droplet real quick and try installing xbrowsersync again, if you think that will help diagnose the problem. I'm still getting this set up, so I'm not going to lose much if I have to start over from scratch.
I went ahead and tried it on a fresh droplet. Nothing but docker and docker-compose installed manually. I still get the same error.
Yeah I think the issue is droplet related as I've never seen this issue before. Compose file v3.7 is supported by docker v18.06.0+ so as long as you're running that you should be fine. For info, I'm running:
Docker version 18.09.0, build 4d60db4
docker-compose version 1.22.0, build f46880fe
on a DO droplet running Ubuntu 18.04.1 LTS and have no issues with Compose v3.7.
Also try Googling the issue if you haven't already as others have reported similar errors which have come down to incorrectly formatted files and conflicting versions, e.g.
Since I was on a new droplet, I changed the version to 3 and it installed fine. I don't understand it well enough to know if that's okay or not. I'll dig around a little more. I'll also see if I can get on a newer version of docker-compose. I was using the one included in DO's repos. Maybe 1.22 will solve the issue. Thanks for your help!
No worries @azuntik. I'll close this but post back if you have any more questions, I'll help if I can.
Manually updated to docker-compose 1.24 and it went just fine. 1.17 doesn't work, apparently. Thanks again!
I receive following error when running docker-compose up -d :
xbs-db is up-to-date
xbs-api is up-to-date
Recreating 9b7b11e44bc1_xbs-reverse-proxy ... error
ERROR: for 9b7b11e44bc1_xbs-reverse-proxy Cannot start service reverse-proxy: driver failed programming external connectivity on endpoint xbs-reverse-proxy (d4bf894c6c36dc81d7c7b26e257ce430d6e2c256c096651d176432c2f567234c): Error starting userland proxy: listen tcp 0.0.0.0:80: bind: address already in use
because my apache2 server is already listening on port 80
tcp6 0 0 :::80 :::* LISTEN 4133/apache2
udp6 0 0 fe80::11:32ff:fe23::546 :::* 763/systemd-network
unix 3 [ ] STREAM CONNECTED 17980 860/dbus-daemon /var/run/dbus/system_bus_socket
unix 3 [ ] DGRAM 16680 763/systemd-network
unix 3 [ ] DGRAM 26780 2779/systemd
unix 3 [ ] STREAM CONNECTED 15480 1/init /run/systemd/journal/stdout
unix 3 [ ] STREAM CONNECTED 18057 863/accounts-daemon
unix 3 [ ] STREAM CONNECTED 18058 1/init /run/systemd/journal/stdout
Hi @ErikMonten, you can't have two different services listen on the same port. Either stop Apache before running docker-compose up -d
or change the Traefik ports config in docker-compose.yml. For example, if you want to have HTTP traffic from port 8081
on your host directed to the xBrowserSync service, update the port mapping to:
- "8081:80"
p.s. Unless you are running Apache to serve other content, you don't need to run it in front of your xBrowserSync service as we use Traefik as a reverse proxy in front of the Node service.
I have stopped the apache server now. Also changed the traefik port to 8081:80.
docker ps =
CONTAINER ID IMAGE PORTS NAMES
015bde9e6dda traefik:1.7.12-alpine 0.0.0.0:443->443/tcp, 0.0.0.0:8081->80/tcp xbs-reverse-proxy
bbbaf73100da xbrowsersync/api:1.1.9 8080/tcp xbs-api
5d16daf076e8 mongo:4.0.10 27017/tcp xbs-db
I now get 192.168.0.192 refused to connect
netstat -tulpn | grep :80 gives me =
tcp6 0 0 :::8081 :::* LISTEN -
I wonder what I'm doing wrong.
ps : I'm working on a virgin ubuntu 18.04.2 server with only xbrowsersync/api running on it
@ErikMonten really sorry for the delayed response, lost track of this issue. Did you get it resolved in the end? If all three containers are running then you have to make sure that the XBS_API_HOSTNAME
value you set in .env
resolves to localhost, then access the api in the browser using that hostname, otherwise traefik cannot route the request correctly.
If you're still having problems after that, try running docker-compose logs
and see if you have any errors. If it's working correctly you should have the following entries in the logs:
xbs-db | 2019-10-22T15:09:59.338+0000 I ACCESS [conn3] Successfully authenticated as principal xbsdb on admin from client 172.31.0.3:43030
xbs-api | {"name":"xBrowserSync_api","hostname":"1b55a166c53b","pid":1,"level":30,"msg":"Service started on 127.0.0.1:8080","time":"2019-10-22T15:09:59.347Z","v":0}