Saril Sudhakaran
Saril Sudhakaran

Reputation: 1129

Passing Docker options using Dockerfile

I am using AWS ECS to run Docker-based tasks. Since ECS agent task definitions don't support all Docker options, I'm looking for some workaround to pass these options to the docker run command.

Is it possible to pass Docker options like --memory-swappiness, --memory-swap, etc. using Dockerfiles?

Upvotes: 0

Views: 127

Answers (1)

mcsim
mcsim

Reputation: 1798

You should use something like docker compose for that. Docker compose allows to specify parameters for you containers. In contrast Dockerfile configures your image. For example to limit resources you just create resources section in you compose.yml. Note that swappiness is an obsolete parameter.

See link: https://docs.docker.com/compose/compose-file/#resources

version: '3'
services:
  redis:
    image: redis:alpine
    deploy:
      resources:
        limits:
          cpus: '0.50'
          memory: 50M
        reservations:
          cpus: '0.25'
          memory: 20M

Upvotes: 1

Related Questions