New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Hints on #7

iBobik opened this Issue Feb 13, 2016 · 4 comments


None yet
4 participants
Copy link

iBobik commented Feb 13, 2016

Readme should help new users to quickly start using this image.

I am missing there:

  • env. variables to configure Memcached (set storage size)
  • example for docker-compose.yml (ready to copy&paste with available config options)

This comment has been minimized.

Copy link

mahen3d commented Apr 10, 2016

yeah can anybody please post a example for docker-compose.yml to use this ? i am getting contused how to link it to php ..etc


This comment has been minimized.

Copy link

iBobik commented Apr 10, 2016

In old v1 syntax:

  build: ./web
    - "80:80"
    - web_www:/var/www/repo
    - cache

  image: memcached:1

This comment has been minimized.

Copy link

lechup commented May 16, 2016

@iBobik is it actually possible to set memory size throught env var? I see only option to use cmd parameter...


This comment has been minimized.

Copy link

tianon commented Sep 26, 2017

Sorry for the super long tail on replying! 😞

I do not believe memcached upstream supports environment variables (and this image certainly does not add any).

As for specifying many options in a docker-compose.yml, the easiest way IMO would be via YAML's array syntax, something like the following:

        image: memcached:1
            - '--flag-1'
            - '--flag-2'
            - 'flag 2 value'
            - '--flag-3'

Here's a full list of all the current options:

$ docker run --rm memcached -h
memcached 1.5.1
-p, --port=<num>          TCP port to listen on (default: 11211)
-U, --udp-port=<num>      UDP port to listen on (default: 11211, 0 is off)
-s, --unix-socket=<file>  UNIX socket to listen on (disables network support)
-A, --enable-shutdown     enable ascii "shutdown" command
-a, --unix-mask=<mask>    access mask for UNIX socket, in octal (default: 0700)
-l, --listen=<addr>       interface to listen on (default: INADDR_ANY)
-d, --daemon              run as a daemon
-r, --enable-coredumps    maximize core file limit
-u, --user=<user>         assume identity of <username> (only when run as root)
-m, --memory-limit=<num>  item memory in megabytes (default: 64 MB)
-M, --disable-evictions   return error on memory exhausted instead of evicting
-c, --conn-limit=<num>    max simultaneous connections (default: 1024)
-k, --lock-memory         lock down all paged memory
-v, --verbose             verbose (print errors/warnings while in event loop)
-vv                       very verbose (also print client commands/responses)
-vvv                      extremely verbose (internal state transitions)
-h, --help                print this help and exit
-i, --license             print memcached and libevent license
-V, --version             print version and exit
-P, --pidfile=<file>      save PID in <file>, only used with -d option
-f, --slab-growth-factor=<num> chunk size growth factor (default: 1.25)
-n, --slab-min-size=<bytes> min space used for key+value+flags (default: 48)
-L, --enable-largepages  try to use large memory pages (if available)
-D <char>     Use <char> as the delimiter between key prefixes and IDs.
              This is used for per-prefix stats reporting. The default is
              ":" (colon). If this option is specified, stats collection
              is turned on automatically; if not, then it may be turned on
              by sending the "stats detail on" command to the server.
-t, --threads=<num>       number of threads to use (default: 4)
-R, --max-reqs-per-event  maximum number of requests per event, limits the
                          requests processed per connection to prevent 
                          starvation (default: 20)
-C, --disable-cas         disable use of CAS
-b, --listen-backlog=<num> set the backlog queue limit (default: 1024)
-B, --protocol=<name>     protocol - one of ascii, binary, or auto (default)
-I, --max-item-size=<num> adjusts max item size
                          (default: 1mb, min: 1k, max: 128m)
-S, --enable-sasl         turn on Sasl authentication
-F, --disable-flush-all   disable flush_all command
-X, --disable-dumping     disable stats cachedump and lru_crawler metadump
-o, --extended            comma separated list of extended options
                          most options have a 'no_' prefix to disable
   - maxconns_fast:       immediately close new connections after limit
   - hashpower:           an integer multiplier for how large the hash
                          table should be. normally grows at runtime.
                          set based on "STAT hash_power_level"
   - tail_repair_time:    time in seconds for how long to wait before
                          forcefully killing LRU tail item.
                          disabled by default; very dangerous option.
   - hash_algorithm:      the hash table algorithm
                          default is murmur3 hash. options: jenkins, murmur3
   - lru_crawler:         enable LRU Crawler background thread
   - lru_crawler_sleep:   microseconds to sleep between items
                          default is 100.
   - lru_crawler_tocrawl: max items to crawl per slab per run
                          default is 0 (unlimited)
   - lru_maintainer:      enable new LRU system + background thread
   - hot_lru_pct:         pct of slab memory to reserve for hot lru.
                          (requires lru_maintainer)
   - warm_lru_pct:        pct of slab memory to reserve for warm lru.
                          (requires lru_maintainer)
   - hot_max_factor:      items idle > cold lru age * drop from hot lru.
   - warm_max_factor:     items idle > cold lru age * this drop from warm.
   - temporary_ttl:       TTL's below get separate LRU, can't be evicted.
                          (requires lru_maintainer)
   - idle_timeout:        timeout for idle connections
   - slab_chunk_max:      (EXPERIMENTAL) maximum slab size. use extreme care.
   - watcher_logbuf_size: size in kilobytes of per-watcher write buffer.
   - worker_logbuf_size:  size in kilobytes of per-worker-thread buffer
                          read by background thread, then written to watchers.
   - track_sizes:         enable dynamic reports for 'stats sizes' command.
   - no_inline_ascii_resp: save up to 24 bytes per item.
                           small perf hit in ASCII, no perf difference in
                           binary protocol. speeds up all sets.
   - modern:              enables options which will be default in future.
             currently: nothing
   - no_modern:           uses defaults of previous major version (1.4.x)

@tianon tianon closed this Sep 26, 2017

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment