Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Issue "Could not fetch/save url https://download.docker.com/linux/centos/docker-ce.repo"

I am trying to set up the Docker repository on CentOS, after I run the command

$ sudo yum-config-manager --add-repo https://download.docker.com/linux/centos/docker-ce.repo

I am getting error message:

Could not fetch/save url https://download.docker.com/linux/centos/docker-ce.repo to file /etc/yum.repos.d/docker-ce.repo: [Errno 12] Timeout on https://download.docker.com/linux/centos/docker-ce.repo: (28, 'Operation timed out after 30005 milliseconds with 0 out of 0 bytes received')

I am following the docker documentation to set up the repository.

Step 1: Install required packages. yum-utils provides the yum-config-manager utility, and device-mapper-persistent-data and lvm2 are required by the devicemapper storage driver.

$ sudo yum install -y yum-utils device-mapper-persistent-data lvm2

Step 2: Use the following command to set up the stable repository.

$ sudo yum-config-manager --add-repo https://download.docker.com/linux/centos/docker-ce.repo

Expected result: System should download the files.

Actual result: Not able to download the files.

like image 603
Ryan Song Avatar asked May 27 '19 01:05

Ryan Song


1 Answers

I have the same problem but I solved it by updating the yum config file, just add timeout=120 to /etc/yum.conf:

cachedir=/var/cache/yum/$basearch/$releasever
keepcache=0
debuglevel=2
logfile=/var/log/yum.log
exactarch=1
obsoletes=1
gpgcheck=1
plugins=1
installonly_limit=5
bugtracker_url=http://bugs.centos.org/set_project.php?project_id=23&ref=http://bugs.centos.org/bug_report_page.php?category=yum
distroverpkg=centos-release

#add timeout here
timeout=120

Set timeout to 2 min (or 3 min = 180), restart the server then re-run your command.

NOTE: you need to edit the yum.conf file as a super user in order to be able to save your changes.

  • To switch to super user run next:
sudo -i
  • To edit your file and save the changes use the nano editor (or Vi).

I think that it is not necessarily a good solution but it worked well for me.

Should help!

like image 181
xang Ultimate Avatar answered Sep 24 '22 21:09

xang Ultimate