Docker study notes [3] Install Redis

Redis is used in the project, which is usually built by others. Today, I try to build a learning environment on Google Cloud Platform.

1. Use docker pull redis to download images from docker hub

2. Use docker images to check whether the installation is successful, if successful, the image list will be displayed

3. Use the docker run --name container-name -d image-name command to run a container

4. Use docker container ps to view the container list. If the previous step is successful, test-redis will be displayed

5. Use docker stop container-name/container-id to stop the container

6. Start the container you just stopped again docker start test-redis

7. The software port running in the Docker container cannot be accessed in the local area network or the local area network, so it is necessary to map the port in the Docker container to the port of the current host.

  docker run -d -p 6378:6379 --name port-redis redis

8. View container logs through docker logs container-name/container-id

9. Log in to the container through the docker exec -it container-id/container-name bash command

10. Log in to Redis through the redis-cli command and check whether the ping is successful.

 

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=324532659&siteId=291194637