Initial import (#1436970)
Signed-off-by: Petr "Stone" Hracek <phracek@redhat.com>
This commit is contained in:
parent
5f935c50d4
commit
b33d552746
5 changed files with 243 additions and 0 deletions
38
Dockerfile
Normal file
38
Dockerfile
Normal file
|
|
@ -0,0 +1,38 @@
|
|||
FROM registry.fedoraproject.org/fedora:26
|
||||
|
||||
# memcached image for OpenShift.
|
||||
#
|
||||
# Environment:
|
||||
# * $CACHE_SIZE - Cache size for memcached
|
||||
# Ports:
|
||||
# * 11211
|
||||
|
||||
ENV NAME=memcached
|
||||
LABEL MAINTAINER "Petr Hracek" <phracek@redhat.com>
|
||||
LABEL summary="High Performance, Distributed Memory Object Cache" \
|
||||
name="$FGC/$NAME" \
|
||||
version="0" \
|
||||
release="1.$DISTTAG" \
|
||||
architecture="$ARCH" \
|
||||
com.redhat.component=$NAME \
|
||||
usage="docker run -p 11211:11211 f26/memcached" \
|
||||
help="Runs memcached, which listens on port 11211. No dependencies. See Help File below for more details." \
|
||||
description="memcached is a high-performance, distributed memory object caching system, generic in nature, but intended for use in speeding up dynamic web applications by alleviating database load." \
|
||||
io.k8s.description="memcached is a high-performance, distributed memory object caching system, generic in nature, but intended for use in speeding up dynamic web applications by alleviating database load." \
|
||||
io.k8s.diplay-name="Memcached 1.4 " \
|
||||
io.openshift.expose-services="11211:memcached" \
|
||||
io.openshift.tags="memcached"
|
||||
|
||||
RUN dnf install -y --setopt=tsflags=nodocs memcached && \
|
||||
dnf -y clean all
|
||||
|
||||
|
||||
ADD files /files
|
||||
ADD help.md README.md /
|
||||
|
||||
EXPOSE 11211
|
||||
|
||||
# memcached will be run under standard user on Fedora
|
||||
USER 1000
|
||||
|
||||
CMD ["/files/memcached.sh"]
|
||||
112
README.md
Normal file
112
README.md
Normal file
|
|
@ -0,0 +1,112 @@
|
|||
# memcached
|
||||
|
||||
Memcached is High Performance, Distributed Memory Object Cache
|
||||
|
||||
## Summary
|
||||
|
||||
- Dockerfile - build container image with memcached.
|
||||
- openshift-template.yml - Template for OpenShift to memcached.
|
||||
|
||||
|
||||
## How to use the container over standard 11211 port
|
||||
|
||||
Command for running memcached docker container:
|
||||
|
||||
```bash
|
||||
docker run -it -e CACHE_SIZE=128 \
|
||||
-p 11211:11211
|
||||
```
|
||||
|
||||
If you would like to increase a CACHE_SIZE use environment variable -e CACHE_SIZE:
|
||||
```bash
|
||||
docker run -it -e CACHE_SIZE=128 \
|
||||
-p 11211:11211
|
||||
```
|
||||
|
||||
## How to run memcached as standalone container
|
||||
|
||||
Copy memcached-container.service to ```/usr/lib/systemd/user/``` directory
|
||||
```bash
|
||||
sudo cp memcached-container.service /usr/lib/systemd/user/
|
||||
systemctl --user daemon-reload
|
||||
```
|
||||
|
||||
Command for running memcached as standalone container:
|
||||
```bash
|
||||
systemctl start --user memcached-container
|
||||
```
|
||||
|
||||
## How to stop memcached as standalone container
|
||||
Command for stopping memcached as standalone container:
|
||||
```bash
|
||||
systemctl stop --user memcached-container
|
||||
```
|
||||
## How to test the memcached
|
||||
|
||||
Commands for testing memcached docker container:
|
||||
|
||||
To store data in memcached server with telnet:
|
||||
```bash
|
||||
set KEY META_DATA EXPIRY_TIME LENGTH_IN_BYTES
|
||||
```
|
||||
|
||||
To get data
|
||||
```bash
|
||||
get KEY
|
||||
```
|
||||
|
||||
To overwrite existing key
|
||||
```bash
|
||||
replace KEY META_DATA EXPIRE_TIME LENGTH_IN_BYTES
|
||||
```
|
||||
|
||||
To delete key
|
||||
```bash
|
||||
delete KEY
|
||||
```
|
||||
|
||||
To get the server statistics
|
||||
```bash
|
||||
stats
|
||||
stats items
|
||||
stats slabs
|
||||
|
||||
```
|
||||
|
||||
To clear the metadata statistics
|
||||
```bash
|
||||
flush all
|
||||
```
|
||||
|
||||
Memcached Server Telnet Example (taken from http://www.journaldev.com/16/memcached-telnet-commands-with-example)
|
||||
```bash
|
||||
set Test 0 100 10
|
||||
JournalDev
|
||||
STORED
|
||||
get Test
|
||||
VALUE Test 0 10
|
||||
JournalDev
|
||||
END
|
||||
replace Test 0 100 4
|
||||
Temp
|
||||
STORED
|
||||
get Test
|
||||
VALUE Test 0 4
|
||||
Temp
|
||||
END
|
||||
stats items
|
||||
STAT items:1:number 1
|
||||
STAT items:1:age 19
|
||||
STAT items:1:evicted 0
|
||||
STAT items:1:evicted_time 0
|
||||
STAT items:1:outofmemory 0
|
||||
STAT items:1:tailrepairs 0
|
||||
END
|
||||
flush_all
|
||||
OK
|
||||
get Test
|
||||
END
|
||||
version
|
||||
VERSION 1.4.25
|
||||
quit
|
||||
```
|
||||
37
help.md
Normal file
37
help.md
Normal file
|
|
@ -0,0 +1,37 @@
|
|||
% MEMCACHED(1) Container Image Pages
|
||||
% Petr Hracek
|
||||
% February 6, 2017
|
||||
|
||||
# NAME
|
||||
memcached - High Performance, Distributed Memory Object Cache.
|
||||
|
||||
# DESCRIPTION
|
||||
Memcached is a high-performance, distributed memory object caching system, generic in nature, but intended for use in speeding up dynamic web applications by alleviating database load.
|
||||
|
||||
The container itself consists of:
|
||||
- fedora/24 base image
|
||||
- memcached RPM package
|
||||
|
||||
Files added to the container during docker build include: /files/memcached.sh
|
||||
|
||||
# USAGE
|
||||
To get the memcached container image on your local system, run the following:
|
||||
|
||||
docker pull hub.docker.io/phracek/memcached
|
||||
|
||||
|
||||
# ENVIRONMENT VARIABLES
|
||||
The memcached container includes the following environment variables:
|
||||
|
||||
CACHE_SIZE=128
|
||||
The variable sets size of cached used by memcached.
|
||||
|
||||
# SECURITY IMPLICATIONS
|
||||
Lists of security-related attributes that are opened to the host.
|
||||
|
||||
-p 11211:11211
|
||||
Opens container port 11211 and maps it to the same port on the host.
|
||||
|
||||
# SEE ALSO
|
||||
Memcached page
|
||||
<https://memcached.org/>
|
||||
10
memcached-container.service
Normal file
10
memcached-container.service
Normal file
|
|
@ -0,0 +1,10 @@
|
|||
[Unit]
|
||||
Description="The memcached is High Performance, Distributed Memory Object Cache."
|
||||
|
||||
[Service]
|
||||
ExecStart=/usr/bin/docker run -t -i -v /etc/sysconfig/memcached:/etc/sysconfig/memcached:ro -p 11211:11211 --name memcached-container memcached
|
||||
ExecStop=/usr/bin/docker stop -t 2 memcached-container
|
||||
ExecStopPost=/usr/bin/docker rm -f memcached-container
|
||||
|
||||
[Install]
|
||||
WantedBy=multi-user.target
|
||||
46
openshift-template.yml
Normal file
46
openshift-template.yml
Normal file
|
|
@ -0,0 +1,46 @@
|
|||
apiVersion: v1
|
||||
kind: Template
|
||||
metadata:
|
||||
labels:
|
||||
description: memcached is a high-performance, distributed memory object caching system, generic in nature, but intended for use in speeding up dynamic web applications by alleviating database load.
|
||||
tags: memcached
|
||||
template: docker.io/modularitycontainers/memcached
|
||||
name: memcached
|
||||
objects:
|
||||
- apiVersion: v1
|
||||
kind: ImageStream
|
||||
metadata:
|
||||
name: memcached
|
||||
spec:
|
||||
dockerImageRepository: docker.io/modularitycontainers/memcached
|
||||
tags:
|
||||
- name: latest
|
||||
- apiVersion: v1
|
||||
kind: DeploymentConfig
|
||||
metadata:
|
||||
name: memcached
|
||||
spec:
|
||||
dockerImageRepository: docker.io/modularitycontainers/memcached
|
||||
replicas: 1
|
||||
strategy:
|
||||
type: Rolling
|
||||
template:
|
||||
metadata:
|
||||
labels:
|
||||
name: memcached
|
||||
spec:
|
||||
containers:
|
||||
- env:
|
||||
image: docker.io/modularitycontainers/memcached
|
||||
name: memcached
|
||||
ports:
|
||||
- containerPort: 11211
|
||||
triggers:
|
||||
- imageChangeParams:
|
||||
automatic: true
|
||||
containerNames:
|
||||
- docker.io/modularitycontainers/memcached
|
||||
from:
|
||||
kind: ImageStreamTag
|
||||
name: memcached:latest
|
||||
type: ImageChange
|
||||
Loading…
Add table
Add a link
Reference in a new issue