test-container.sh 836 B

123456789101112131415161718192021222324252627
  1. #!/bin/sh
  2. . ./common/get_args.sh $*
  3. if [ -z ${PORT} ]
  4. then
  5. REGISTRY_CERT_FILE=/tmp/registry_cert.crt
  6. # Get the registry host certificate
  7. echo -n \
  8. | openssl s_client -connect ${REGISTRY_HOSTNAME}:443 \
  9. | sed -ne '/-BEGIN CERTIFICATE-/,/-END CERTIFICATE-/p' \
  10. > ${REGISTRY_CERT_FILE}
  11. docker run --rm \
  12. -v $(pwd)/test-container-in.sh:/test-container-in.sh \
  13. -v $(pwd)/common/get_args.sh:/common/get_args.sh \
  14. -v ${REGISTRY_CERT_FILE}:/registry_cert.crt \
  15. dolphm/network-tools \
  16. /test-container-in.sh ${REGISTRY_HOSTNAME}
  17. else
  18. docker run --rm \
  19. -v $(pwd)/test-container-in.sh:/test-container-in.sh \
  20. -v $(pwd)/common/get_args.sh:/common/get_args.sh \
  21. dolphm/network-tools \
  22. /test-container-in.sh ${REGISTRY_HOSTNAME}
  23. fi