docker-archive / compose-cli

Easily run your Compose application to the cloud with compose-cli
Apache License 2.0
957 stars 254 forks source link

Unnecessary warnings when deploying with a ECS context: services.scale unsupported #2142

Open chrisbecke opened 2 years ago

chrisbecke commented 2 years ago

Description

When I deploy a docker-compose.yml file to ECS I get a warning about entries that are not present.

Steps to reproduce the issue:

  1. Create an ECS docker context.
  2. Deploy the provided docker-compose.yml to AWS.

docker-compose.yml

services:
  web:
    image: nginx:latest

Describe the results you received:

% docker compose up
WARNING services.scale: unsupported attribute

Output of docker compose version:

$ docker context show
ecs
$ docker compose version
Docker Compose version dev
$ docker context use default
default
$ docker compose version
Docker Compose version v2.2.1

Output of docker info:

$ docker --context ecs info
Command "info" not available in current context (ecs), you can use the "default" context to run this command
$ docker --context default info
Client:
 Context:    default
 Debug Mode: false
 Plugins:
  buildx: Docker Buildx (Docker Inc., v0.7.1)
  compose: Docker Compose (Docker Inc., v2.2.1)
  scan: Docker Scan (Docker Inc., v0.14.0)

Server:
 Containers: 32
  Running: 0
  Paused: 0
  Stopped: 32
 Images: 48
 Server Version: 20.10.11
 Storage Driver: overlay2
  Backing Filesystem: extfs
  Supports d_type: true
  Native Overlay Diff: true
  userxattr: false
 Logging Driver: json-file
 Cgroup Driver: cgroupfs
 Cgroup Version: 2
 Plugins:
  Volume: local
  Network: bridge host ipvlan macvlan null overlay
  Log: awslogs fluentd gcplogs gelf journald json-file local logentries splunk syslog
 Swarm: active
  NodeID: h9lj2fmidgjiomevframlmt5o
  Is Manager: true
  ClusterID: ephu9kkco8i2yog3w1fddepzc
  Managers: 1
  Nodes: 1
  Default Address Pool: 10.0.0.0/8  
  SubnetSize: 24
  Data Path Port: 4789
  Orchestration:
   Task History Retention Limit: 5
  Raft:
   Snapshot Interval: 10000
   Number of Old Snapshots to Retain: 0
   Heartbeat Tick: 1
   Election Tick: 10
  Dispatcher:
   Heartbeat Period: 5 seconds
  CA Configuration:
   Expiry Duration: 3 months
   Force Rotate: 0
  Autolock Managers: false
  Root Rotation In Progress: false
  Node Address: 192.168.65.3
  Manager Addresses:
   192.168.65.3:2377
 Runtimes: io.containerd.runc.v2 io.containerd.runtime.v1.linux runc
 Default Runtime: runc
 Init Binary: docker-init
 containerd version: 7b11cfaabd73bb80907dd23182b9347b4245eb5d
 runc version: v1.0.2-0-g52b36a2
 init version: de40ad0
 Security Options:
  seccomp
   Profile: default
  cgroupns
 Kernel Version: 5.10.76-linuxkit
 Operating System: Docker Desktop
 OSType: linux
 Architecture: x86_64
 CPUs: 2
 Total Memory: 15.64GiB
 Name: docker-desktop
 ID: VWKQ:VE33:ZEI5:33BD:2W4R:ESBQ:HWNL:JXQZ:6VKL:HPNB:LK35:FARU
 Docker Root Dir: /var/lib/docker
 Debug Mode: false
 HTTP Proxy: http.docker.internal:3128
 HTTPS Proxy: http.docker.internal:3128
 Registry: https://index.docker.io/v1/
 Labels:
 Experimental: false
 Insecure Registries:
  127.0.0.0/8
 Live Restore Enabled: false
 Default Address Pools:
   Base: 172.16.0.0/16, Size: 20
   Base: 172.17.0.0/16, Size: 20
ssensalo commented 2 years ago

I am actually having a similar issue

WARNING services.scale: unsupported attribute        
ECS Fargate does not support bind mounts from host: incompatible attribute
ndeloof commented 2 years ago

This repo is about docker compose, not "cloud integration". @glours could you please transfert to docker/compose-cli?

ShaanHash commented 2 years ago

I am having a similar issue as @ssensalo.

AWS does seem to support bind mounts on Fargate now - however it seems that the validation this repo conducts still forbids it.

JohnPreston commented 2 years ago

Hello @ShaanHash and @chrisbecke Hoping that ECS Compose-X might be able to workaround that problem for you using simple docker-compose volumes definitions.

It supports to have volumes shared between tasks/containers (when defined at the top level of the compose file), as well as "ephemeral" docker volumes (i.e. volumes: ['/var/mount/to/path']). If you set driver_opts for EFS, it will pick that up too.

Been using that for many applications now, mostly a ton of kafka, and this works very well. You can also define how much Fargate ephemeral storage you want to assign to the task, up to 200G, as per Fargate definitions in 1.4.0.

Hope this helps,

ssensalo commented 2 years ago

Hi @JohnPreston Your response is helpful, currently, I am able to mount the EFS volume but the container keeps failing. This is how I have written my docker-compose.yaml

version: "2"
services:
  lawuna_server:
    environment:
          DB_USER = ["DB_USER"]
          DB_PASSWORD = ["DB_PASSWORD"]
          DB_HOST = ["DB_HOST"]
          DB_PORT = ["DB_PORT"]
          DB_NAME = ["DB_NAME"]
    image: <docker-image-url>
    restart: always
    volumes: 
      - lawuna_server_data:/app
    ports:
      - "5000:5000"
    command: gunicorn -w 3 -b 0.0.0.0:5000 main:app

volumes:
  lawuna_server_data:

When I check my logs in ECS the cause of the failure of the task is ResourceInitializationError: failed to invoke EFS utils commands to set up EFS volumes: command failed with 32: failed to execute command to invoke EFS utils: mount.nfs4: Connection reset by peer

JohnPreston commented 2 years ago

I have never seen this syntax for compose before

        enviroment:
          DB_USER = ["DB_USER"]
          DB_PASSWORD = ["DB_PASSWORD"]
          DB_HOST = ["DB_HOST"]
          DB_PORT = ["DB_PORT"]
          DB_NAME = ["DB_NAME"]

Curious to understand how this works :thinking:

On the issue you get, this seems to be the best place to figure it out: https://aws.amazon.com/premiumsupport/knowledge-center/fargate-unable-to-mount-efs/

It that compose example what you used with the ECS Plugin or compose-x ?

Eternal21 commented 2 years ago

I'm assuming the scale warning is safe to ignore? I'm guessing the warning is issued due to docker-compose defaulting to scale of 1, even if you don't specify any?

benknight commented 1 year ago

+1

stale[bot] commented 1 year ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.