SaminOz / redis-random-data-generator

Generate and insert random values into a redis instance from the command line
ISC License
12 stars 0 forks source link

Add Docker support #6

Closed pataquets closed 7 years ago

pataquets commented 7 years ago

Add Dockerfile to enable image building. Using the official nodejs image. More info at https://hub.docker.com/_/node/ Allowed me to work on this software without any NodeJS setup on my Linux dev box.

Since it's not possible to specify the target Redis server other than config file (eg, command-line or env var), I've resorted to replace 127.0.0.1 by redis as the default Redis server in the included config file for the image, since neither localhost nor 127.0.0.1 would work from inside a container.

As of now, you can either:

Build:

$ docker build -t redis-random-data-generator .

Run a Redis server to use it later for testing (exposing Redis port -p is not required):

$ docker run --rm -it --name redis [ -p 6379:6379 ] redis:3 redis-server --save "" --maxmemory 1gb

From another terminal, launch a container from the above built image:

docker run --rm -it --link redis:redis redis-random-data-generator [ options... ]

FYI, there's a still quicker to test, already built image on my Docker Hub. Test it by running:

$ docker run --rm -it --link redis:redis pataquets/redis-random-data-generator [ options... ]

Notice I'm using the --rm (remove container on finish) and interactive mode (-it) Docker launch flags. Stop containers by CTRL+C'ing them.

Optional improvement to come:

pataquets commented 7 years ago

Fancy to create an 'official' Docker Hub Automated Build image? See OP. An AB on Docker Hub under the same account name than the Gh repo would provide a hands-free distribution/packaging method at each commit without additional work. It's an easy & quick, one-time setup.

pataquets commented 7 years ago

@SaminOz ping?

pataquets commented 7 years ago

@SaminOz : ping?

SaminOz commented 7 years ago

@https://github.com/pataquets : pong :)

On 19 October 2017 at 00:00, Alfonso Montero notifications@github.com wrote:

@SaminOz https://github.com/saminoz : ping?

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/SaminOz/redis-random-data-generator/pull/6#issuecomment-337752139, or mute the thread https://github.com/notifications/unsubscribe-auth/AD7V1O3oqlEvbS0aVj1A5UShniaHissVks5stoMegaJpZM4LfxOd .

--

Sam Moore