compose: Cannot start services when ports are mentioned

For some reason I cannot bind the port correctly. When I remove the port, it works. If i change the port to any other number, it still does not work

version: '3'
services:
  rtorrent:
    container_name: rtorrent
    image: yusufali/rtorrent
    privileged: true
  web_nginx:
    container_name: web_nginx
    image: marvambass/nginx-ssl-secure
    links:
      - rtorrent:rtorrent
    ports:
      - "8800:80"

However, run I run docker-com up -d, this does not work

Creating network "docker_default" with the default driver
Creating rtorrent
Creating web_nginx

ERROR: for web_nginx  Cannot create container for service web_nginx: invalid port specification: "None"
ERROR: Encountered errors while bringing up the project.

Useful info:

# docker-compose --version
docker-compose version 1.12.0, build b31ff33
# docker --version
Docker version 17.04.0-ce, build 4845c56
# uname -a
Linux gsad 4.4.30-mod-std-ipv6-64 #9 SMP Tue Nov 1 17:58:26 CET 2016 x86_64 GNU/Linux

About this issue

  • Original URL
  • State: closed
  • Created 7 years ago
  • Reactions: 1
  • Comments: 17

Commits related to this issue

Most upvoted comments

I had same error with my port map and i solved that. Just wrote a map as string

ports:
    - 8080:80
... 

replace with:

ports:
    - "8080:80"
...

i am using docker-compose version 1.21.2, build a133471

@shin- absolutely. But I’m running Ubuntu 14.04, so downgrading docker-compose was a simpler solution.

I believe this Python bug is the cause of the issue: https://bugs.python.org/issue24931 Upgrading to Python 3.4.4+ or 3.5.1+ should fix it.

Hi experiencing the same problem just with Python3.5.0. 2.7 and 3.5.1 / 3.5.2 / 3.5.3 are working fine. A quickfix for me right now is to to use docker-compose < 1.12.0

I’ve experienced the same issue on Python 3.5, installed via pip. Similarly, using python 2 fixes the issue. I experienced the issue with file versions 2.1 and 3.0, 3.2 but not 3.1.

It might be an issue with Python 3 - I’ll take another look. In the meantime, you might want to try using Python 2.7 instead and see if the issue still occurs.