Compare commits

...
Sign in to create a new pull request.

4 commits

Author SHA1 Message Date
Petr "Stone" Hracek
5a4b8a6153 Update container image according to Fedora-Dockerfiles 2017-09-06 12:15:32 +02:00
Tomas Tomecek
71ccb35e58 rebuild - bump release
Signed-off-by: Tomas Tomecek <ttomecek@redhat.com>
2017-08-21 21:44:20 +02:00
Tomas Tomecek
79b840a5eb sync with upstream
Signed-off-by: Tomas Tomecek <ttomecek@redhat.com>
2017-08-21 17:02:11 +02:00
Petr "Stone" Hracek
5097d0e7d4 Add missing files directory
Signed-off-by: Petr "Stone" Hracek <phracek@redhat.com>
2017-04-12 10:15:36 +02:00
5 changed files with 167 additions and 102 deletions

View file

@ -1,4 +1,4 @@
FROM registry.fedoraproject.org/fedora:26
FROM registry.fedoraproject.org/fedora:rawhide
# memcached image for OpenShift.
#
@ -12,10 +12,10 @@ LABEL MAINTAINER "Petr Hracek" <phracek@redhat.com>
LABEL summary="High Performance, Distributed Memory Object Cache" \
name="$FGC/$NAME" \
version="0" \
release="1.$DISTTAG" \
release="3.$DISTTAG" \
architecture="$ARCH" \
com.redhat.component=$NAME \
usage="docker run -p 11211:11211 f26/memcached" \
usage="docker run -p 11211:11211 registry.fedoraproject.org/rawhide/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." \
@ -23,12 +23,11 @@ LABEL summary="High Performance, Distributed Memory Object Cache" \
io.openshift.expose-services="11211:memcached" \
io.openshift.tags="memcached"
RUN dnf install -y --setopt=tsflags=nodocs memcached && \
RUN dnf -y --nodocs install memcached && \
dnf -y clean all
ADD files /files
ADD help.md README.md /
ADD root/help.1 /help.1
EXPOSE 11211

184
README.md
View file

@ -2,111 +2,85 @@
Memcached is High Performance, Distributed Memory Object Cache
## Summary
## How to use the container
Pull the image from Docker Hub:
```bash
$ sudo docker pull registry.fedoraproject.org/memcached:rawhide
```
Run the container
```bash
docker run -it -p 11211:11211 --name memcached modularitycontainers/memcached
```
If you would like to debug memcached, use container option =e MEMCACHED_DEBUG_MODE:
```bash
docker run -it -p 11211:11211
[-e MEMCACHED_DEBUG_MODE]
--name memcached modularitycontainers/memcached
```
If you would like to change memcached options, like cache_size, connections or threads, use environment variable -e MEMCACHED_CACHE_SIZE, -e MEMCACHED_CONNECTIONS, -e MEMCACHED_THREADS respectively:
```bash
docker run -it -p 11211:11211
[-e MEMCACHED_CACHE_SIZE=<size_in_MB>]
[-e MEMCACHED_CONNECTIONS=<max_simultaneous_connections>]
[-e MEMCACHED_THREADS=<max_concurrent_threads>]
--name memcached modularitycontainers/memcached
```
## A demo
Here is a simple demo how to run memcached
* Copy systemd service which will take care of memcached container:
```bash
$ sudo cp -av memcached-container.service /usr/lib/systemd/system/
$ sudo systemctl daemon-reload
```
* We can start memcached now:
```bash
$ sudo systemctl start memcached-container
```
* You should be able to test memcached by commands (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
```
## Repository structure
- 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
```

23
files/memcached.sh Executable file
View file

@ -0,0 +1,23 @@
#!/bin/bash
MEMCACHED_ARGS=
if [[ ! -z "${MEMCACHED_DEBUG_MODE}" ]]; then
MEMCACHED_ARGS+=" -vv"
fi
if [[ ! -z "${MEMCACHED_CACHE_SIZE}" ]]; then
MEMCACHED_ARGS+=" -m $MEMCACHED_CACHE_SIZE"
fi
if [[ ! -z "${MEMCACHED_CONNECTIONS}" ]]; then
MEMCACHED_ARGS+=" -c $MEMCACHED_CONNECTIONS"
fi
if [[ ! -z "${MEMCACHED_THREADS}" ]]; then
MEMCACHED_ARGS+=" -t $MEMCACHED_THREADS"
fi
# Run memcached binary
/usr/bin/memcached -u daemon $MEMCACHED_ARGS

17
help.md
View file

@ -9,7 +9,7 @@ memcached - High Performance, Distributed Memory Object Cache.
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
- fedora/rawhide base image
- memcached RPM package
Files added to the container during docker build include: /files/memcached.sh
@ -17,14 +17,23 @@ 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
docker pull registry.fedoraproject.org/memcached:rawhide
# ENVIRONMENT VARIABLES
The memcached container includes the following environment variables:
CACHE_SIZE=128
The variable sets size of cached used by memcached.
For turn on verbose mode, use environment variable
-e MEMCACHED_DEBUG_MODE
For setting cache size, use environment variable
-e MEMCACHED_CACHE_SIZE
For setting maximum connections, use environment variable
-e MEMCACHED_CONNECTIONS
For setting maximum threads, use environment variable
-e MEMCACHED_THREADS
# SECURITY IMPLICATIONS
Lists of security-related attributes that are opened to the host.

60
root/help.1 Normal file
View file

@ -0,0 +1,60 @@
.TH "MEMCACHED" "1" " Container Image Pages" "Petr Hracek" "February 6, 2017"
.nh
.ad l
.SH NAME
.PP
memcached \- High Performance, Distributed Memory Object Cache.
.SH DESCRIPTION
.PP
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.
.PP
The container itself consists of:
\- fedora/24 base image
\- memcached RPM package
.PP
Files added to the container during docker build include: /files/memcached.sh
.SH USAGE
.PP
To get the memcached container image on your local system, run the following:
.PP
.RS
.nf
docker pull hub.docker.io/phracek/memcached
.fi
.RE
.SH ENVIRONMENT VARIABLES
.PP
The memcached container includes the following environment variables:
.PP
CACHE\_SIZE=128
The variable sets size of cached used by memcached.
.SH SECURITY IMPLICATIONS
.PP
Lists of security\-related attributes that are opened to the host.
.PP
\-p 11211:11211
Opens container port 11211 and maps it to the same port on the host.
.SH SEE ALSO
.PP
Memcached page
\[la]https://memcached.org/\[ra]