Merge ~ubuntu-docker-images/ubuntu-docker-images/+git/memcached:readme into ~ubuntu-docker-images/ubuntu-docker-images/+git/memcached:edge

Proposed by Lucas Kanashiro
Status: Merged
Approved by: Lucas Kanashiro
Approved revision: 46fbe7464cb3242f3553825a9169867bca9e9168
Merged at revision: 46fbe7464cb3242f3553825a9169867bca9e9168
Proposed branch: ~ubuntu-docker-images/ubuntu-docker-images/+git/memcached:readme
Merge into: ~ubuntu-docker-images/ubuntu-docker-images/+git/memcached:edge
Diff against target: 231 lines (+199/-0)
5 files modified
HACKING.md (+14/-0)
README.md (+86/-0)
examples/README.md (+37/-0)
examples/docker-compose.yml (+14/-0)
examples/microk8s-deployments.yml (+48/-0)
Reviewer Review Type Date Requested Status
Lucas Kanashiro Approve
Sergio Durigan Junior Needs Fixing
Review via email: mp+393671@code.launchpad.net

Description of the change

Improve README file of the OCI image as requested in LP #1904005

To post a comment you must log in.
Revision history for this message
Sergio Durigan Junior (sergiodj) wrote :

Thanks for the MP, Lucas! I've made a few comments, but tried to keep them to a minimum. After you fix them, feel free to go ahead and merge what you have.

review: Needs Fixing
Revision history for this message
Lucas Kanashiro (lucaskanashiro) wrote :

Thanks Sergio! I addressed your comments and tried to clarify how authentication is working at the moment.

I am merging it now but if there is any question reach out to me.

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1diff --git a/HACKING.md b/HACKING.md
2new file mode 100644
3index 0000000..012f4eb
4--- /dev/null
5+++ b/HACKING.md
6@@ -0,0 +1,14 @@
7+# Contributing
8+
9+In order to contribute to the Memcached OCI image do the following:
10+
11+* Create a new branch.
12+* Make your changes. Keep your commits logically separated. If it is fixing a bug do not forget to mention it in the commit message.
13+* Build a new image with your changes. You can use the following command:
14+
15+```
16+$ docker build -t squeakywheel/memcached:test -f Dockerfile .
17+```
18+
19+* Test the new image. Run it in some way that exercise your changes, you can also check th README.md file.
20+* If everything goes well submit a merge proposal.
21diff --git a/README.md b/README.md
22index 11359a7..aeb9ed9 100644
23--- a/README.md
24+++ b/README.md
25@@ -6,3 +6,89 @@ https://github.com/docker-library/memcached
26 The only change made is installing memcached from the Ubuntu archive instead of building it from source. The Ubuntu package already supports running memcached using its CLI only (not depending on a service), so no other change was required.
27
28 There is no change that should impact users.
29+
30+## Versions supported
31+
32+* `edge` = `1.5.22-2ubuntu0.2` (package from Ubuntu Focal)
33+
34+## Architectures supported
35+
36+* amd64
37+* arm64
38+* ppc64el
39+* s390x
40+
41+## Usage
42+
43+To get this image run:
44+
45+```
46+$ docker pull squeakywheel/memcached:edge
47+```
48+
49+Memcached will usually work together with another app. To let them communicate you can create a docker network and then launch the memcached and the app containers:
50+
51+```
52+$ docker network create app-net --driver bridge
53+$ docker run -d --name memcached \
54+ --network app-net \
55+ squeakywheel/memcached:edge
56+```
57+
58+Then run your app container with `--network app-net` and they will be able to communicate between themselves (by default `memcached` listens on port `11211`).
59+
60+### Environment Variables
61+
62+Most of the memcached configuration is done via environment variables. Some of the most used variables are the following:
63+
64+* `MEMCACHED_CACHE_SIZE`: determines the size of the cache, the default is `64MB`.
65+* `MEMCACHED_MAX_CONNECTIONS`: determines the maximum number of concurrent connections, the default is `1024`.
66+* `MEMCACHED_THREADS`: determines the number of threads to process requests, the default is `4`.
67+* `MEMCACHED_PASSWORD`: define the password for the `root` user if another username is provided. By default the authentication is disabled but if this option is passed it becomes enabled.
68+* `MEMCACHED_USERNAME`: define a new user. If this option is passed a password is needed to authenticate the new user.
69+
70+An example of how you can run memcached passing those variables:
71+
72+```
73+$ docker run -d --name memcached \
74+ --network net \
75+ --env MEMCACHED_CACHE_SIZE=128 \
76+ --env MEMCACHED_MAX_CONNECTIONS=2048 \
77+ --env MEMCACHED_THREADS=8 \
78+ --env MEMCACHED_USERNAME=john \
79+ --env MEMCACHED_PASSWORD=pAs$wd \
80+ squeakywheel/memcached:edge
81+```
82+
83+There are cases where one might want to pass some memcached command line flags that are not configurable via environment variables. In this case you can pass the flags themselves or a shell script:
84+
85+```
86+$ docker run -d --name memcached \
87+ --network net \
88+ squeakywheel/memcached:edge
89+ <flags_or_script_with_flags>
90+```
91+
92+### Debugging
93+
94+In case you need to debug what it is happening with the container you can run `docker logs <name_of_the_container>`. But if you want to get access to an interactive shell run:
95+
96+```
97+$ docker exec -it <name_of_the_container> /bin/bash
98+```
99+
100+To see how to use the memcached OCI image with `docker-compose` and `microk8s` check the `examples/README.md` file.
101+
102+## Bugs and Features request
103+
104+If you find a bug in our image or want to request a specific feature file a bug here:
105+
106+https://bugs.launchpad.net/ubuntu-server-oci/+filebug
107+
108+In the title of the bug add `memcached: <reason>`.
109+
110+Make sure to include:
111+
112+* The tag of the image you are using
113+* Reproduction steps for the deployment
114+* If it is a feature request, please provide as much detail as possible
115diff --git a/examples/README.md b/examples/README.md
116new file mode 100644
117index 0000000..d44bdb0
118--- /dev/null
119+++ b/examples/README.md
120@@ -0,0 +1,37 @@
121+# Running the examples
122+
123+## docker-compose
124+
125+Install `docker-compose` from the Ubuntu archive:
126+
127+```
128+$ sudo apt install -y docker-compose
129+```
130+
131+Call `docker-compose` from the examples directory:
132+
133+```
134+$ docker-compose up -d
135+```
136+
137+Memcached will be listening on port `11211` in your host. To stop it run:
138+
139+```
140+$ docker-compose down
141+```
142+
143+# Microk8s
144+
145+With microk8s running, enable the `dns` and `storage` add-ons:
146+
147+```
148+$ microk8s enable dns storage
149+```
150+
151+Apply the `microk8s-deployments.yml`:
152+
153+```
154+$ microk8s kubectl apply -f microk8s-deployments.yml
155+```
156+
157+Memcached will be listening on port `31211` in your host.
158diff --git a/examples/docker-compose.yml b/examples/docker-compose.yml
159new file mode 100644
160index 0000000..3149458
161--- /dev/null
162+++ b/examples/docker-compose.yml
163@@ -0,0 +1,14 @@
164+version: '2'
165+
166+services:
167+ memcached:
168+ image: squeakywheel/memcached:edge
169+ network_mode: "host"
170+ ports:
171+ - 11211:11211
172+ environment:
173+ - MEMCACHED_CACHE_SIZE=128
174+ - MEMCACHED_MAX_CONNECTIONS=2048
175+ - MEMCACHED_THREADS=8
176+ - MEMCACHED_USERNAME=john
177+ - MEMCACHED_PASSWORD=pAs$wd
178diff --git a/examples/microk8s-deployments.yml b/examples/microk8s-deployments.yml
179new file mode 100644
180index 0000000..ada3efa
181--- /dev/null
182+++ b/examples/microk8s-deployments.yml
183@@ -0,0 +1,48 @@
184+---
185+apiVersion: apps/v1
186+kind: Deployment
187+metadata:
188+ name: memcached-deployment
189+spec:
190+ replicas: 1
191+ selector:
192+ matchLabels:
193+ app: memcached
194+ template:
195+ metadata:
196+ labels:
197+ app: memcached
198+ spec:
199+ containers:
200+ - name: memcached
201+ image: squeakywheel/memcached:edge
202+ env:
203+ - name: MEMCACHED_CACHE_SIZE
204+ value: "128"
205+ - name: MEMCACHED_MAX_CONNECTIONS
206+ value: "2048"
207+ - name: MEMCACHED_THREADS
208+ value: "8"
209+ - name: MEMCACHED_USERNAME
210+ value: "john"
211+ - name: MEMCACHED_PASSWORD
212+ value: "pAs$wd"
213+ ports:
214+ - containerPort: 11211
215+ name: memcached
216+ protocol: TCP
217+---
218+apiVersion: v1
219+kind: Service
220+metadata:
221+ name: memcached-service
222+spec:
223+ type: NodePort
224+ selector:
225+ app: memcached
226+ ports:
227+ - protocol: TCP
228+ port: 11211
229+ targetPort: 11211
230+ nodePort: 31211
231+ name: memcached

Subscribers

People subscribed via source and target branches

to all changes: