Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to flush all of the cached contents of Docker memcached?

How to flush all of the cached contents of Docker container memcached from command line without rstarting memcached?

like image 505
caot Avatar asked Mar 21 '18 12:03

caot


2 Answers

docker exec -it $MEMCACHE_CONTAINER_ID bash -c "echo flush_all > /dev/tcp/localhost/11211"

like image 186
vivekyad4v Avatar answered Nov 15 '22 07:11

vivekyad4v


Assuming that you have the memcahed port 11211 exposed. You can flush the cache via either telnet or nc and sending flush_all

echo flush_all | nc localhost 11211
OK

You can replace localhost, with the machine hostname if you are not executing the command on the same machine where the container is running.

like image 38
yamenk Avatar answered Nov 15 '22 07:11

yamenk