Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

617
Views
Changing Redis port in Docker Compose not working

I have a Docker Compose file that starts two services: Redis and Redis Commander. Using the default Redis port 6379 works fine. After changing the Redis port to 6380 Redis Commander cannot connect to Redis anymore.

Error:

setUpConnection Redis error Error: connect ECONNREFUSED 172.19.0.2:6380

This is the docker-compose.yml file:

version: '3.7'
services:
  redis:
    container_name: redis
    hostname: redis
    image: sameersbn/redis:4.0.9-2
    ports:
      - "6380:6379"
    expose:
      - "6380"
    volumes:
      - type: volume
        source: redis-data
        target: /data
    restart: always
  redis-commander:
    container_name: redis-commander
    hostname: redis-commander
    image: rediscommander/redis-commander:latest
    restart: always
    environment:
      - REDIS_HOSTS=local:redis:6380
    ports:
      - "8082:8081"
volumes:
  redis-data: {}

I can connect to Redis on port 6380 using the following Node code:

import redis from 'redis'

const config = {
  host: '127.0.0.1',
  port: 6380,
  no_ready_check: true
}

const client = redis.createClient(config.port, config.host)

client.set('expireName', 'nidkil', (err, reply) => {
  if (err) {
    console.error('Error occurred:', err)
  } else {
    console.log('Response:', reply)
  }
})

If I change the port back to 6379 in the docker-compose.yml then Redis Commander can connect.

Any suggestions how I can make Redis Commander connect to Redis on port 6380?

over 4 years ago · Santiago Trujillo
2 answers
Answer question

0

The answer of @Mihai helpt me figure out the solution. I needed to change the port Redis is running on as well as the exposed port. This is the working Docker compose file.

version: '3.7'
services:
  redis:
    container_name: redis
    hostname: redis
    image: sameersbn/redis:4.0.9-2
    command: --port 6380
    ports:
      - "6380:6380"
    expose:
      - "6380"
    volumes:
      - type: volume
        source: redis-data
        target: /data
    restart: always
  redis-commander:
    container_name: redis-commander
    hostname: redis-commander
    image: rediscommander/redis-commander:latest
    restart: always
    environment:
      - REDIS_HOSTS=local:redis:6380
    ports:
      - "8082:8081"
volumes:
  redis-data: {}
over 4 years ago · Santiago Trujillo Report

0

You changed the exposed port on the host. You did not change the internal port in the container. Your redis instance continues to run on the default port (6379).

Also this statement expose: - "6380" can be omitted since it is not useful.

over 4 years ago · Santiago Trujillo Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!