The docker container has been deleted. Why is link still there?

  docker, question

The web-server container was created by the run command, and the db container was link. now I normally stopped the web-server container and deleted it.
I changed to use docker-compose management, and reported an error when I was up:

ERROR: Service ‘web-server’ has a link to service ‘db-mysql’ which is undefined.

What’s going on here, that is to say, link will not be deleted automatically? What do I need to do now?

~$ sudo docker ps
 CONTAINER ID        IMAGE                     COMMAND                  CREATED             STATUS              PORTS                                                          NAMES
 4904797541ed        mysql:latest              "docker-entrypoint..."   6 months ago        Up 25 minutes       3306/tcp                                                       db-mysql
version: '2'
 
 services:
 web-server:
 build: .
 hostname: web-server
 restart: always
 container_name: web-server
 links:
 - db-mysql
 ports:
 - "80:80"
 - "443:443"
 volumes:
 - ./htdocs:/var/web/htdocs
 - ./default-root:/var/www/html
 - ./nginx.config:/etc/nginx

Yoursdb-mysqlThere is no container, generally if there is no such container, it will correspond to the configurationimageBuild container. Corresponding to the containerimageThere is no such thing.

You’d better put yourdocker-composeThe content of the post out to see see