Memcached is an in-memory key-value store for small chunks of arbitrary data (strings, objects) from results of database calls, API calls, or page rendering.
$ docker run --name memcached bitnami/memcached:latest$ curl -sSL https://raw.githubusercontent.com/bitnami/bitnami-docker-memcached/master/docker-compose.yml > docker-compose.yml
$ docker-compose up -d- Bitnami closely tracks upstream source changes and promptly publishes new versions of this image using our automated systems.
- With Bitnami images the latest bug fixes and features are available as soon as possible.
- Bitnami containers, virtual machines and cloud images use the same components and configuration approach - making it easy to switch between formats based on your project needs.
- All our images are based on minideb a minimalist Debian based container image which gives you a small base container image and the familiarity of a leading Linux distribution.
- All Bitnami images available in Docker Hub are signed with Docker Content Trust (DCT). You can use
DOCKER_CONTENT_TRUST=1to verify the integrity of the images. - Bitnami container images are released daily with the latest distribution packages available.
This CVE scan report contains a security report with all open CVEs. To get the list of actionable security issues, find the "latest" tag, click the vulnerability report link under the corresponding "Security scan" field and then select the "Only show fixable" filter on the next page.
Deploying Bitnami applications as Helm Charts is the easiest way to get started with our applications on Kubernetes. Read more about the installation in the Bitnami Memcached Chart GitHub repository.
Bitnami containers can be used with Kubeapps for deployment and management of Helm Charts in clusters.
Non-root container images add an extra layer of security and are generally recommended for production environments. However, because they run as a non-root user, privileged tasks are typically off-limits. Learn more about non-root containers in our docs.
Learn more about the Bitnami tagging policy and the difference between rolling tags and immutable tags in our documentation page.
Subscribe to project updates by watching the bitnami/memcached GitHub repo.
The recommended way to get the Bitnami Memcached Docker Image is to pull the prebuilt image from the Docker Hub Registry.
$ docker pull bitnami/memcached:latestTo use a specific version, you can pull a versioned tag. You can view the list of available versions in the Docker Hub Registry.
$ docker pull bitnami/memcached:[TAG]If you wish, you can also build the image yourself.
docker build -t bitnami/memcached:latest 'https://github.com/bitnami/bitnami-docker-memcached.git#master:1/debian-10'Using Docker container networking, a Memcached server running inside a container can easily be accessed by your application containers.
Containers attached to the same network can communicate with each other using the container name as the hostname.
$ docker network create app-tier --driver bridgeUse the --network app-tier argument to the docker run command to attach the Memcached container to the app-tier network.
$ docker run -d --name memcached-server \
--network app-tier \
bitnami/memcached:latest$ docker run -d --name myapp \
--network app-tier \
YOUR_APPLICATION_IMAGEIMPORTANT:
- Please update the YOUR_APPLICATION_IMAGE_ placeholder in the above snippet with your application image
- In your application container, use the hostname
memcached-serverto connect to the Memcached server
When not specified, Docker Compose automatically sets up a new network and attaches all deployed services to that network. However, we will explicitly define a new bridge network named app-tier. In this example we assume that you want to connect to the Memcached server from your own custom application image which is identified in the following snippet by the service name myapp.
version: '2'
networks:
app-tier:
driver: bridge
services:
memcached:
image: 'bitnami/memcached:latest'
networks:
- app-tier
myapp:
image: 'YOUR_APPLICATION_IMAGE'
networks:
- app-tierIMPORTANT:
- Please update the YOUR_APPLICATION_IMAGE_ placeholder in the above snippet with your application image
- In your application container, use the hostname
memcachedto connect to the Memcached server
Launch the containers using:
$ docker-compose up -dBy default, the Bitnami Memcached container will not specify any cache size and will start with Memcached defaults (64MB). You can specify a different value with the MEMCACHED_CACHE_SIZE environment variable (in MB).
$ docker run --name memcached -e MEMCACHED_CACHE_SIZE=128 bitnami/memcached:latestor by modifying the docker-compose.yml file present in this repository:
services:
memcached:
...
environment:
- MEMCACHED_CACHE_SIZE=128
...By default, the Bitnami Memcached container will not specify any maximum number of concurrent connections and will start with Memcached defaults (1024 concurrent connections). You can specify a different value with the MEMCACHED_MAX_CONNECTIONS environment variable.
$ docker run --name memcached -e MEMCACHED_MAX_CONNECTIONS=2000 bitnami/memcached:latestor by modifying the docker-compose.yml file present in this repository:
services:
memcached:
...
environment:
- MEMCACHED_MAX_CONNECTIONS=2000
...By default, the Bitnami Memcached container will not specify the amount of threads for which to process requests for and will start with Memcached defaults (4 threads). You can specify a different value with the MEMCACHED_THREADS environment variable.
$ docker run --name memcached -e MEMCACHED_THREADS=4 bitnami/memcached:latestor by modifying the docker-compose.yml file present in this repository:
services:
memcached:
...
environment:
- MEMCACHED_THREADS=4
...Authentication on the Memcached server is disabled by default. To enable authentication, specify the password for the Memcached admin user using the MEMCACHED_PASSWORD environment variable (or in the content of the file specified in MEMCACHED_PASSWORD_FILE).
To customize the username of the Memcached admin user, which defaults to root, the MEMCACHED_USERNAME variable should be specified.
$ docker run --name memcached \
-e MEMCACHED_USERNAME=my_user \
-e MEMCACHED_PASSWORD=my_password \
bitnami/memcached:latestor by modifying the docker-compose.yml file present in this repository:
version: '2'
services:
memcached:
...
environment:
- MEMCACHED_USERNAME=my_user
- MEMCACHED_PASSWORD=my_password
...The default value of the
MEMCACHED_USERNAMEisroot.
Passing extra command-line flags to the Memcached service command is possible by adding them as arguments to run.sh script:
$ docker run --name memcached bitnami/memcached:latest /opt/bitnami/scripts/memcached/run.sh -vvvAlternatively, modify the docker-compose.yml file present in this repository:
services:
memcached:
...
command: /opt/bitnami/scripts/memcached/run.sh -vvv
...Refer to the Memcached man page for the complete list of arguments.
In order to load your own SASL configuration file, you will have to make them available to the container. You can do it doing the following:
- Mounting a volume with your custom configuration
- Adding custom configuration via environment variable.
By default, when authentication is enabled the SASL configuration of Memcached is written to /opt/bitnami/memcached/sasl2/memcached.conf file with the following content:
mech_list: plain
sasldb_path: /opt/bitnami/memcached/conf/memcachedsasldb
The /opt/bitnami/memcached/conf/memcachedsasldb is the path to the sasldb file that contains the list of Memcached users.
The Bitnami Memcached Docker image sends the container logs to the stdout. To view the logs:
$ docker logs memcachedor using Docker Compose:
$ docker-compose logs memcachedYou can configure the containers logging driver using the --log-driver option if you wish to consume the container logs differently. In the default configuration docker uses the json-file driver.
Bitnami provides up-to-date versions of Memcached, including security patches, soon after they are made upstream. We recommend that you follow these steps to upgrade your container.
$ docker pull bitnami/memcached:latestor if you're using Docker Compose, update the value of the image property to
bitnami/memcached:latest.
$ docker rm -v memcachedor using Docker Compose:
$ docker-compose rm -v memcachedRe-create your container from the new image.
$ docker run --name memcached bitnami/memcached:latestor using Docker Compose:
$ docker-compose up memcached- Fixes regression in Memcached Authentication introduced in release
1.5.18-debian-9-r6and1.5.18-ol-7-r7(#62).
- Decrease the size of the container. The configuration logic is now based on Bash scripts in the `rootfs/ folder.
- Custom SASL configuration should be mounted at
/opt/bitnami/memcached/conf/sasl2/instead of/bitnami/memcached/conf/. - Password for Memcached admin user can be specified in the content of the file specified in
MEMCACHED_PASSWORD_FILE.
- The memcached container has been migrated to a non-root container approach. Previously the container run as
rootuser and the memcached daemon was started asmemcacheduser. From now own, both the container and the memcached daemon run as user1001. As a consequence, the configuration files are writable by the user running the memcached process.
MEMCACHED_USERparameter has been renamed toMEMCACHED_USERNAME.
- The logs are always sent to the
stdoutand are no longer collected in the volume.
We'd love for you to contribute to this container. You can request new features by creating an issue, or submit a pull request with your contribution.
If you encountered a problem running this container, you can file an issue. For us to provide better support, be sure to include the following information in your issue:
- Host OS and version
- Docker version (
docker version) - Output of
docker info - Version of this container (
echo $BITNAMI_IMAGE_VERSIONinside the container) - The command you used to run the container, and any relevant output you saw (masking any sensitive information)
Copyright (c) 2015-2020 Bitnami
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.