Solution to the inaccessibility of docker after starting: 1. Execute the "docker run -itd -p" command; 2. Enter "docker ps -a" to view "ports"; 3. Check the linux version and docker version ; 4. Enter the "yum update" command line to upgrade the kernel; 5. Restart the kernel.

The operating environment of this tutorial: Windows 7 system, Docker version 20.10.11, Dell G3 computer.
What should I do if I cannot access docker after it is started?
The Docker container is started successfully but the browser cannot be accessed (after the Docker container is started, check docker ps -a and you cannot see the ports (the ports column is empty) | The linux kernel version and the docker version are incompatible)
Scenario: The Docker container is started successfully but the browser cannot access it
I am learning the basic operations of the Docker container. I pulled the tomcat image and entered the run container command to run the container. There was no problem with a series of operations, but when browsing When the server accesses the port, it cannot access it
[root@localhost ~]# docker run -d -p 8081:8080 --name mytomcat b8dfe9ade316

1. After the Docker container is started, check docker ps -a and you cannot see the ports (the ports column is empty)
After testing various command lines, I finally entered the command to display all container information and found that the ports line was empty! ! !
[root@localhost ~]# docker ps -a
Then I didn’t know what keywords to find to describe this situation, so I tried various methods, such as uninstalling and reinstalling the old version of tomcat, turning off the firewall, and setting up the firewall to allow or restrict specified IPs. Neither the port nor the firewall worked. I even formatted the output to display the specified column but still couldn't see the ports. After many twists and turns, I finally found the method of blogger Jacen_Chou and tried it, and it worked! ! ! Thank you blogger Jacen_Chou for your help. My mood is just like what the blogger said at the end. When I saw the success, I was so excited that I almost cried.
The blogger said that as long as -d Just add it in front, and I finally found out that this situation is called Docker port mapping not working
[root@localhost ~]# docker run -itd -p 8081:8080 --name mytomcat b8dfe9ade316
Then enter docker ps -a, and finally see the contents of the ports line

2. The linux kernel version and the docker version are incompatible
I thought the problem had been solved. Logically speaking, there was no problem. I opened the browser happily, but still No 5555, I continued to look for the reason, and returned to the original keywords. The docker container was started successfully but could not be accessed. After a search, I saw that Qingren blogger said that the Linux system kernel may be low, and the docker version is the latest version. So it's not compatible.
I quickly checked my linux version and docker version, and the result is really like this. My docker is version 20.10.11, and linux is only 3.8. It took me a long time to figure it out. It turns out that the problem is version incompatibility. , quickly enter the yum update command line to upgrade the kernel
#查看linux内核版本 [root@localhost ~]# uname -sr #查看docker版本 [root@localhost ~]# docker version #升级linux内核版本,升级所有包同时也升级软件和系统内核 [root@localhost ~]# yum update -y
After a long wait for the upgrade, I suggest you search for how to upgrade the larger version of the Linux kernel version, because yum update is only suitable for small version upgrades, and there are many steps to upgrade the large version. I'm too lazy to try.
Finally, don’t forget to restart centos and the container after the upgrade.
Finally, I finally saw my damn Tom Cat~~

Solution:
Check whether the Docker port mapping is successful, and whether the Linux kernel version and the docker version are compatible. If they are not compatible, there are two methods, either reduce the docker version (uninstall the higher version and reinstall it) Either upgrade the Linux kernel version, and don’t forget to restart the host after the upgrade.
Ended with flowers~~~
Recommended learning: "docker video tutorial"
The above is the detailed content of What should I do if I cannot access docker after it is started?. For more information, please follow other related articles on the PHP Chinese website!
Linux and Docker: Docker on Different Linux DistributionsApr 19, 2025 am 12:10 AMThe methods of installing and using Docker on Ubuntu, CentOS, and Debian are different. 1) Ubuntu: Use the apt package manager, the command is sudoapt-getupdate&&sudoapt-getinstalldocker.io. 2) CentOS: Use the yum package manager and you need to add the Docker repository. The command is sudoyumininstall-yyum-utils&&sudoyum-config-manager--add-repohttps://download.docker.com/lin
Mastering Docker: A Guide for Linux UsersApr 18, 2025 am 12:08 AMUsing Docker on Linux can improve development efficiency and simplify application deployment. 1) Pull Ubuntu image: dockerpullubuntu. 2) Run Ubuntu container: dockerrun-itubuntu/bin/bash. 3) Create Dockerfile containing nginx: FROMubuntu;RUNapt-getupdate&&apt-getinstall-ynginx;EXPOSE80. 4) Build the image: dockerbuild-tmy-nginx. 5) Run container: dockerrun-d-p8080:80
Docker on Linux: Applications and Use CasesApr 17, 2025 am 12:10 AMDocker simplifies application deployment and management on Linux. 1) Docker is a containerized platform that packages applications and their dependencies into lightweight and portable containers. 2) On Linux, Docker uses cgroups and namespaces to implement container isolation and resource management. 3) Basic usages include pulling images and running containers. Advanced usages such as DockerCompose can define multi-container applications. 4) Debug commonly used dockerlogs and dockerexec commands. 5) Performance optimization can reduce the image size through multi-stage construction, and keeping the Dockerfile simple is the best practice.
Docker: Containerizing Applications for Portability and ScalabilityApr 16, 2025 am 12:09 AMDocker is a Linux container technology-based tool used to package, distribute and run applications to improve application portability and scalability. 1) Dockerbuild and dockerrun commands can be used to build and run Docker containers. 2) DockerCompose is used to define and run multi-container Docker applications to simplify microservice management. 3) Using multi-stage construction can optimize the image size and improve the application startup speed. 4) Viewing container logs is an effective way to debug container problems.
How to start containers by dockerApr 15, 2025 pm 12:27 PMDocker container startup steps: Pull the container image: Run "docker pull [mirror name]". Create a container: Use "docker create [options] [mirror name] [commands and parameters]". Start the container: Execute "docker start [Container name or ID]". Check container status: Verify that the container is running with "docker ps".
How to view logs from dockerApr 15, 2025 pm 12:24 PMThe methods to view Docker logs include: using the docker logs command, for example: docker logs CONTAINER_NAME Use the docker exec command to run /bin/sh and view the log file, for example: docker exec -it CONTAINER_NAME /bin/sh ; cat /var/log/CONTAINER_NAME.log Use the docker-compose logs command of Docker Compose, for example: docker-compose -f docker-com
How to check the name of the docker containerApr 15, 2025 pm 12:21 PMYou can query the Docker container name by following the steps: List all containers (docker ps). Filter the container list (using the grep command). Gets the container name (located in the "NAMES" column).
How to create containers for dockerApr 15, 2025 pm 12:18 PMCreate a container in Docker: 1. Pull the image: docker pull [mirror name] 2. Create a container: docker run [Options] [mirror name] [Command] 3. Start the container: docker start [Container name]


Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

Video Face Swap
Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Article

Hot Tools

Notepad++7.3.1
Easy-to-use and free code editor

SublimeText3 Chinese version
Chinese version, very easy to use

DVWA
Damn Vulnerable Web App (DVWA) is a PHP/MySQL web application that is very vulnerable. Its main goals are to be an aid for security professionals to test their skills and tools in a legal environment, to help web developers better understand the process of securing web applications, and to help teachers/students teach/learn in a classroom environment Web application security. The goal of DVWA is to practice some of the most common web vulnerabilities through a simple and straightforward interface, with varying degrees of difficulty. Please note that this software

Zend Studio 13.0.1
Powerful PHP integrated development environment

PhpStorm Mac version
The latest (2018.2.1) professional PHP integrated development tool






