Through volume, dock and docker.sock are mounted in jenkins container and executed in the container
docker run --link redis:redis --name test -d test
Report the following error:
docker: Error response from daemon: Cannot link to /redis, as it does not belong to the default network.
Is it because of execution inside the container?
Docker creates a default network for a container when it starts-
containerName_defaul, so use the
--linkThe above error will be reported due to the default that containers are not in a network when interconnected by way of. The solution is to add
--net XX_defaultTo make the new container and link targets in the same network.