{"version":"https://jsonfeed.org/version/1.1","title":"NOBODY","home_page_url":"https://duizhang.fun","feed_url":"https://microfeed-duizhang-fun.pages.dev/json/","description":"","icon":"https://media-cdn.duizhang.fun/microfeed-duizhang-fun/production/images/channel-3c1360303d5cbae39b48cc2146aa8d0c.jpg","favicon":"https://microfeed-duizhang-fun.pages.dev/assets/default/favicon.png","authors":[{"name":"duizhang"}],"language":"en-us","items":[{"id":"dceI-a79uwA","title":"docker配置代理拉取镜像","url":"https://f.duizhang.fun/i/dockerdaili-dceI-a79uwA/","content_html":"<!DOCTYPE html>\n<html lang=\"en\">\n<head>\n    <meta charset=\"UTF-8\">\n    <meta name=\"viewport\" content=\"width=device-width, initial-scale=1.0\">\n    <title>Setting Up Docker with Proxy on Ubuntu Server</title>\n    <style>\n        body {\n            font-family: Arial, sans-serif;\n            margin: 20px;\n            line-height: 1.6;\n        }\n        h1, h2 {\n            color: #333;\n        }\n        pre {\n            background-color: #f4f4f4;\n            padding: 10px;\n            border-left: 4px solid #007bff;\n            overflow-x: auto;\n        }\n        code {\n            font-family: 'Courier New', monospace;\n            color: #d63384;\n        }\n    </style>\n</head>\n<body>\n\n<h1>Setting Up Docker with Proxy on Ubuntu Server</h1>\n\n<p>In this guide, we will walk through the process of configuring Docker to work behind an HTTP proxy on an Ubuntu server. This setup is essential for environments where direct internet access is restricted.</p>\n\n<h2>Step 1: Verify Docker Installation</h2>\n\n<p>First, let's confirm that Docker is installed and check its version:</p>\n\n<pre><code>root@ubuntuserver:/home/zw# docker --version\nDocker version 27.2.0, build 3ab4256\n</code></pre>\n\n<p>If Docker is not installed, you can follow the official Docker installation guide for Ubuntu.</p>\n\n<h2>Step 2: Create Configuration Directory</h2>\n\n<p>Next, we need to create a directory for Docker's systemd service overrides:</p>\n\n<pre><code>root@ubuntuserver:/home/zw# sudo mkdir -p /etc/systemd/system/docker.service.d\n</code></pre>\n\n<h2>Step 3: Create Proxy Configuration File</h2>\n\n<p>Now, we will create a configuration file for the HTTP proxy. Attempting to directly edit the file will result in an error, as it does not yet exist:</p>\n\n<pre><code>root@ubuntuserver:/home/zw# /etc/systemd/system/docker.service.d/http-proxy.conf\nbash: /etc/systemd/system/docker.service.d/http-proxy.conf: No such file or directory\n</code></pre>\n\n<p>Instead, we will create and edit the file using <code>vim</code>:</p>\n\n<pre><code>root@ubuntuserver:/home/zw# sudo vim /etc/systemd/system/docker.service.d/http-proxy.conf\n</code></pre>\n\n<p>In this file, add the following lines to configure the proxy settings:</p>\n\n<pre><code>[Service]\nEnvironment=\"HTTP_PROXY=http://192.168.1.241:27890/\"\nEnvironment=\"HTTPS_PROXY=http://192.168.1.241:27890/\"\n</code></pre>\n\n<h2>Step 4: Reload Systemd and Restart Docker</h2>\n\n<p>After saving the configuration, reload the systemd manager configuration to recognize the new settings:</p>\n\n<pre><code>root@ubuntuserver:/home/zw# sudo systemctl daemon-reload\n</code></pre>\n\n<p>Then restart the Docker service to apply the changes:</p>\n\n<pre><code>root@ubuntuserver:/home/zw# sudo systemctl restart docker\n</code></pre>\n\n<h2>Step 5: Verify Proxy Settings</h2>\n\n<p>To ensure that Docker is using the proxy correctly, you can check the environment variables for the Docker service:</p>\n\n<pre><code>root@ubuntuserver:/home/zw# sudo systemctl show --property=Environment docker\nEnvironment=HTTP_PROXY=http://192.168.1.241:27890 HTTPS_PROXY=http://192.168.1.241:27890\n</code></pre>\n\n<h2>Step 6: Pull a Docker Image</h2>\n\n<p>Finally, test the configuration by pulling a Docker image. In this example, we will pull the Debian image:</p>\n\n<pre><code>root@ubuntuserver:/home/zw# docker pull debian\nUsing default tag: latest\nlatest: Pulling from library/debian\n903681d87777: Pull complete\nDigest: sha256:aadf411dc9ed5199bc7dab48b3e6ce18f8bbee4f170127f5ff1b75cd8035eb36\nStatus: Downloaded newer image for debian:latest\ndocker.io/library/debian:latest\n</code></pre>\n\n<h2>Conclusion</h2>\n\n<p>By following these steps, you have successfully configured Docker to work behind an HTTP proxy on your Ubuntu server. This allows you to pull images and perform other Docker operations in environments with restricted internet access.</p>\n\n</body>\n</html>","content_text":"SETTING UP DOCKER WITH PROXY ON UBUNTU SERVER\n\nIn this guide, we will walk through the process of configuring Docker to work\nbehind an HTTP proxy on an Ubuntu server. This setup is essential for\nenvironments where direct internet access is restricted.\n\n\nSTEP 1: VERIFY DOCKER INSTALLATION\n\nFirst, let's confirm that Docker is installed and check its version:\n\nroot@ubuntuserver:/home/zw# docker --version\nDocker version 27.2.0, build 3ab4256\n\n\nIf Docker is not installed, you can follow the official Docker installation\nguide for Ubuntu.\n\n\nSTEP 2: CREATE CONFIGURATION DIRECTORY\n\nNext, we need to create a directory for Docker's systemd service overrides:\n\nroot@ubuntuserver:/home/zw# sudo mkdir -p /etc/systemd/system/docker.service.d\n\n\n\nSTEP 3: CREATE PROXY CONFIGURATION FILE\n\nNow, we will create a configuration file for the HTTP proxy. Attempting to\ndirectly edit the file will result in an error, as it does not yet exist:\n\nroot@ubuntuserver:/home/zw# /etc/systemd/system/docker.service.d/http-proxy.conf\nbash: /etc/systemd/system/docker.service.d/http-proxy.conf: No such file or directory\n\n\nInstead, we will create and edit the file using vim:\n\nroot@ubuntuserver:/home/zw# sudo vim /etc/systemd/system/docker.service.d/http-proxy.conf\n\n\nIn this file, add the following lines to configure the proxy settings:\n\n[Service]\nEnvironment=\"HTTP_PROXY=http://192.168.1.241:27890/\"\nEnvironment=\"HTTPS_PROXY=http://192.168.1.241:27890/\"\n\n\n\nSTEP 4: RELOAD SYSTEMD AND RESTART DOCKER\n\nAfter saving the configuration, reload the systemd manager configuration to\nrecognize the new settings:\n\nroot@ubuntuserver:/home/zw# sudo systemctl daemon-reload\n\n\nThen restart the Docker service to apply the changes:\n\nroot@ubuntuserver:/home/zw# sudo systemctl restart docker\n\n\n\nSTEP 5: VERIFY PROXY SETTINGS\n\nTo ensure that Docker is using the proxy correctly, you can check the\nenvironment variables for the Docker service:\n\nroot@ubuntuserver:/home/zw# sudo systemctl show --property=Environment docker\nEnvironment=HTTP_PROXY=http://192.168.1.241:27890 HTTPS_PROXY=http://192.168.1.241:27890\n\n\n\nSTEP 6: PULL A DOCKER IMAGE\n\nFinally, test the configuration by pulling a Docker image. In this example, we\nwill pull the Debian image:\n\nroot@ubuntuserver:/home/zw# docker pull debian\nUsing default tag: latest\nlatest: Pulling from library/debian\n903681d87777: Pull complete\nDigest: sha256:aadf411dc9ed5199bc7dab48b3e6ce18f8bbee4f170127f5ff1b75cd8035eb36\nStatus: Downloaded newer image for debian:latest\ndocker.io/library/debian:latest\n\n\n\nCONCLUSION\n\nBy following these steps, you have successfully configured Docker to work behind\nan HTTP proxy on your Ubuntu server. This allows you to pull images and perform\nother Docker operations in environments with restricted internet access.","date_published":"2024-06-29T07:46:00.000Z","_microfeed":{"web_url":"https://microfeed-duizhang-fun.pages.dev/i/docker-dceI-a79uwA/","json_url":"https://microfeed-duizhang-fun.pages.dev/i/dceI-a79uwA/json/","rss_url":"https://microfeed-duizhang-fun.pages.dev/i/dceI-a79uwA/rss/","guid":"dceI-a79uwA","status":"published","itunes:episodeType":"full","date_published_short":"Sat Jun 29 2024","date_published_ms":1719647160000}}],"_microfeed":{"microfeed_version":"0.1.2","base_url":"https://microfeed-duizhang-fun.pages.dev","categories":[],"subscribe_methods":[{"name":"RSS","type":"rss","url":"https://microfeed-duizhang-fun.pages.dev/rss/","image":"https://microfeed-duizhang-fun.pages.dev/assets/brands/subscribe/rss.png","enabled":true,"editable":false,"id":"zwPBZNmizOn"},{"name":"JSON","type":"json","url":"https://microfeed-duizhang-fun.pages.dev/json/","image":"https://microfeed-duizhang-fun.pages.dev/assets/brands/subscribe/json.png","enabled":true,"editable":false,"id":"bdiwzxUsdmU"}],"description_text":"","copyright":"©2024","itunes:type":"episodic","itunes:email":"xxynly@gmail.com","items_sort_order":"newest_first"}}