Trying to understand what's happening here:
root@mordor:~#
root@mordor:~# docker ps -a
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
root@mordor:~#
root@mordor:~# docker network ls
NETWORK ID NAME DRIVER SCOPE
10d38d6f1fa1 bridge bridge local
5b5fde2dd7cc foo bridge local
1a7946d0b10c host host local
0cbbb6d4f486 none null local
root@mordor:~#
root@mordor:~# docker run --name rd --network foo -d redis redis-server --appendonly yes
ea782770bcff816a642bc700abd2fadd524e3eeca10820e4c158ae4e72eda139
root@mordor:~#
root@mordor:~# docker container ls
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
ea782770bcff redis "docker-entrypoint.s…" 42 seconds ago Up 40 seconds 6379/tcp rd
root@mordor:~#
root@mordor:~# docker run -it --network foo --rm redis redis-cli -h rd
rd:6379>
rd:6379> ping
PONG
rd:6379>
rd:6379> set foo bar
OK
rd:6379>
rd:6379> get foo
"bar"
rd:6379>
rd:6379> keys *
1) "foo"
rd:6379>
I can see how to spin up the community version of redis
, I only added the foo
network. But why is the connection with run
rather than exec
?