`
gaojingsong
  • 浏览: 1209998 次
  • 性别: Icon_minigender_1
  • 来自: 深圳
文章分类
社区版块
存档分类
最新评论

Docker启动Redis报错

 
阅读更多

[root@node1 gaojs]# cat docker_nginx 

#!/bin/bash

 

docker run --name redis_cache  -p 6379:6379  -d redis

[root@node1 gaojs]# mv docker_nginx  docker_redis

[root@node1 gaojs]# sh docker_redis 

9d36deaf57cdbd716b8942c1500d96445d5c8e4b81ffae18fa652a9e2edda118

/usr/bin/docker-current: Error response from daemon: driver failed programming external connectivity on endpoint redis_cache (3e599869adaac429ba892797fe3b2f2b370d1b1402a199cb741e5981dcc650a8):  (iptables failed: iptables --wait -t nat -A DOCKER -p tcp -d 0/0 --dport 6379 -j DNAT --to-destination 172.17.0.3:6379 ! -i docker0: iptables: No chain/target/match by that name.

 (exit status 1)).

--启动Redis容器报错 ,原因是?

[root@node1 gaojs]# systemctl status firewalld

firewalld.service - firewalld - dynamic firewall daemon

   Loaded: loaded (/usr/lib/systemd/system/firewalld.service; enabled; vendor preset: enabled)

   Active: inactive (dead) since Wed 2021-06-23 06:21:46 EDT; 25min ago

     Docs: man:firewalld(1)

  Process: 812 ExecStart=/usr/sbin/firewalld --nofork --nopid $FIREWALLD_ARGS (code=exited, status=0/SUCCESS)

 Main PID: 812 (code=exited, status=0/SUCCESS)

[root@node1 gaojs]# systemctl  restart docker 

原因是docker先启动,防火墙后停止,停止防火墙后没有重启docker

[root@node1 gaojs]# docker ps -a

CONTAINER ID        IMAGE               COMMAND                  CREATED             STATUS                      PORTS               NAMES

385d2e8747de        mysql               "docker-entrypoint..."   31 minutes ago      Exited (0) 18 seconds ago                       mysqldb

[root@node1 gaojs]# sh docker_mysql 

/usr/bin/docker-current: Error response from daemon: Conflict. The container name "/mysqldb" is already in use by container 385d2e8747de4e07827c571f9605c579d028207c944c723b288b190bd3ad1c01. You have to remove (or rename) that container to be able to reuse that name..

See '/usr/bin/docker-current run --help'.

--同名容器已经存在

[root@node1 gaojs]# docker start mysqldb

mysqldb

[root@node1 gaojs]# docker ps -a

CONTAINER ID        IMAGE               COMMAND                  CREATED             STATUS              PORTS                               NAMES

385d2e8747de        mysql               "docker-entrypoint..."   32 minutes ago      Up 5 seconds        0.0.0.0:3306->3306/tcp, 33060/tcp   mysqldb

[root@node1 gaojs]# sh docker_redis 

62264f43306756280f32a39ddf47755ae855d7546170c51306db5de7418ab401

[root@node1 gaojs]# docker ps -a

CONTAINER ID        IMAGE               COMMAND                  CREATED             STATUS              PORTS                               NAMES

62264f433067        redis               "docker-entrypoint..."   6 seconds ago       Up 4 seconds        0.0.0.0:6379->6379/tcp              redis_cache

385d2e8747de        mysql               "docker-entrypoint..."   32 minutes ago      Up 20 seconds       0.0.0.0:3306->3306/tcp, 33060/tcp   mysqldb

[root@node1 gaojs]# 

分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics