Comments (8)
(for reference, docker ps -a
should show all containers, including stopped ones.)
from serverless-redis-http.
There is a docker compose example in the readme that will work out-of-the-box on any operating system: https://github.com/hiett/serverless-redis-http?tab=readme-ov-file#via-docker-compose
This is the recommended way to run, and a lot easier (because you can stop and start redis & srh at the same time!)
Closing this issue because it's general docker issues rather than anything specific with SRH
from serverless-redis-http.
You shouldn't need a tokens.json file -- the env command will work just fine.
The problem is actually networking. When you put localhost (or 127.0.0.1, same thing), it is looking inside the docker container. It isn't the same localhost as your parent machine.
Not to worry though -- there is an easy fix for this. Assuming you are using Windows or Mac, you can use host.docker.internal
as the IP:
sudo docker run \
-it -d -p 8080:80 --name srh \
-e SRH_MODE=env \
-e SRH_TOKEN=your_token_here \
-e SRH_CONNECTION_STRING="redis://host.docker.internal:6379" \
hiett/serverless-redis-http:latest
This will automatically resolve to your parent system's private IP, and should do the trick!
from serverless-redis-http.
So fast to answer. Thanks a lot. I am actually on Linux Ubuntu.
When I try to run this command, or the command listed in the readme, I get this:
sudo docker run \ 10:39:14
-it -d -p 8080:80 --name srh \
-e SRH_MODE=env \
-e SRH_TOKEN=your_token_here \
-e SRH_CONNECTION_STRING="redis://host.docker.internal:6379" \
hiett/serverless-redis-http:latest
docker: Error response from daemon: Conflict. The container name "/srh" is already in use by container "6b44fb4700db981572d6995e2ec3253427667e3961542af66af27f9dbf8b89a1". You have to remove (or rename) that container to be able to reuse that name.
However, sudo docker ps
is empty. There aren't any running containers
from serverless-redis-http.
This is because the the container is likely stopped in the background, but not removed. you can run docker rm srh
, that should do the trick.
Linux is a bit different -- you might have issues with host.docker.internal. That is a feature of Docker Desktop specifically, not built into the normal Docker engine.
You can use the static IP 172.17.0.1
. This should work on linux and will be bound to the parent machine's IP
from serverless-redis-http.
Thanks so much @hiett. I didn't know about docker ps -a
command. I managed to remove the container, and then I ran this command:
sudo docker run \
-it -d -p 8080:80 --name srh \
-e SRH_MODE=env \
-e SRH_TOKEN=your_token_here \
-e SRH_CONNECTION_STRING="redis://172.17.0.1:6379" \
hiett/serverless-redis-http:latest
I managed to connect to the SRH server from my Next.JS local instance, but still it cannot connect to the redis server running on the parent machine.
Guess i'll do more digging around to understand how to make the container talk to the parent machine. If you have any other suggestions I could try let me know.
Maybe after I manage to do it, we can have a tutorial settings on README for linux? Just a suggestion
from serverless-redis-http.
Maybe would it work if I ran redis inside the container? So that the connection wouldn't need to leave it...
from serverless-redis-http.
Hey, thanks so much! Much better to use docker-compose. Definitely need to use and feel more confident with docker.
Thanks for creating this repo!
from serverless-redis-http.
Related Issues (19)
- Invalid SRH token returns 500 error HOT 3
- Connection refused does not return an error HOT 9
- Error overhaul
- Improve test CI to actually build SRH and run that image HOT 1
- If the Redis server goes down, and a :closed is returned, the pool isn't properly destroyed
- Unicode encoding issues and sorted sets HOT 7
- Make port configurable HOT 2
- SSL Error When Connecting to REDIS via Python <upstash-redis> HOT 1
- any pre-compiled binary to use? HOT 1
- Multi-execs from concurrent users not working HOT 7
- Expose server on IPv6 interface HOT 8
- Running SRH on bare metal alongside Redis HOT 5
- Trying to run in Docker Compose HOT 8
- Seeing this error when running on cloudflare SyntaxError: Unexpected token 'e', "error code: 1003" is not valid JSON HOT 1
- Unhandled Redix error HOT 9
- Issue: Message Not Found HOT 4
- Incorrect encoding in response HOT 7
- RedisJSON warning and differences HOT 6
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from serverless-redis-http.