Tag Archives: # Docker

Docker: How to Enter the Closed Container and View the Logging

During the development process, especially when debugging the code, there will always be a situation where the Dockerfile or application exception causes the application to fail to start.
At this point, you want to go inside the container and see what’s going on.
At this time, I want to use docker exec -it Container_name bash it to enter the container normally, but Error response from daemon: Container baa1e5…… is not runningan exception will occur.

solution

View the container ID that needs to be entered

# View all container processes
docker ps -a 
# Copy the ID of this unbootable container
baa1e5

Save the abnormally started container as an image

# Here is a random mirror name
docker commit baa1e5 temp/test

Start a new container to view the log of the startup process

docker run -it temp/test sh

(20200916 Solved)Docker||redis-cli Could not connect to Redis at 127.0.0.1:6379: Connection refused

  • problem description

    redis-cli is the redis command line interface to interact with the redis service.

  • solution

    1. via configuration file
      $ vi /etc/redis.conf
      # daemonize no 改为 yes
      redis-server /etc/redis.conf
      

      docker startup redis has no configuration file in it. You need to build it yourself.

    2. start directly
      redis-server &
      

      <李>

      引用

      1. 无法连接到127.0.0.1:6379的Redis:使用自制程序拒绝连接