AWS: docker container cannot connect to external website on SSL

On my ec2 instance, there is a container hosting a website (e.g. WordPress).
This containers binds container ports 80 and 443 to ports 8080 ad 8081 of the host (both are enabled for inbound traffic in the security group).

The problem is that the website inside the container needs to connect to external websites on SSL, but it fails in doing so.

  • Docker - AWS - What do I need to do next?
  • Docker random ports & AWS Elastic Load Balancer
  • Installing Python 3 Docker Ubuntu error command 'x86_64-linux-gnu-gcc
  • Set up Docker Swarm on an EC2
  • docker-compose.yml file behaves differently on ECS than local docker-compose
  • Using AWS EFS with Docker
  • It looks like a problem of the security group/firewall…but I coudn’t detect the specific cause yet, as the security group is now it should work.

    If I enter the container, ping of the external website (e.g. wordpress.org) works.

    I don’t know if it is related, but recently the EC2 instance had problem validating ssl certificates, even the python pip tool wasn’t able to validate SSL certificate inside the container.

    Any help?
    Does wordpress use another port – no 443 port – to connect to wordpress.org?

    EDIT1:

    • the specific error message is the following:

    SSL certificate problem: unable to get local issuer certificate

    • one the website is WordPress, and it logs the following message:

    Warning: An unexpected error occurred. Something may be wrong with
    WordPress.org or this server’s configuration. If you continue to have
    problems, please try the support forums. (WordPress could not
    establish a secure connection to WordPress.org. Please contact your
    server administrator.) in /var/www/html/wp-includes/update.php on line
    457

    • the website is not configured to serve https
    • inside both the container and the host the packet ca-certificates is installed

  • Docker container for Laravel: PHP 7.x on CentOS 7.x
  • Do Docker containers share a single Python GIL?
  • Docker mount S3 container
  • Docker - Running Apache and Multiple JARs
  • Amazon EFS access denied while mounting in docker container
  • Amazon AWS ECS Task delay
  • Docker will be the best open platform for developers and sysadmins to build, ship, and run distributed applications.