Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

621
Vistas
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 Respuestas
Responde la pregunta

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 Denunciar

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 Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda