Update and upgrade in dockerfile

I am fairly new to docker and in the tutorials I have read watched so far, … upgrade and … update is ran when producing an image in the docker file.

I am currently trying to build an intellij community image to learn how to do this, as it is a stable piece of software and it will need to use x11 or something similar for the GUI, but I keep getting “Error: Failed to synchronize chache for repo ‘updates’” when the dockerfile is ran.
I have tried running upgrade and update using both dnf and yum in fedora, and by using ubuntu as my base image to try with apt-get, all with the same results.

The only way I have got a connection to the updates repo is by running the dockerfile without, then running a container that is attached to my host operating system, updating and then saving that back to an image.

Is this correct or is there a way to connect to the updates repo from the docker file?

Here is a sample of my code and the error.

base image

FROM fedora:28
LABEL description=“Intellij community edition 2018”

update and upgrade

RUN dnf -y update
RUN dnf -y upgrade

Error: Failed to synchronize cache for repo ‘updates’