{"id":263,"date":"2021-03-26T00:55:11","date_gmt":"2021-03-26T03:55:11","guid":{"rendered":"https:\/\/blog.galsoft.duckdns.org\/?p=263"},"modified":"2023-10-07T13:43:52","modified_gmt":"2023-10-07T16:43:52","slug":"configurar-proxy-en-docker","status":"publish","type":"post","link":"https:\/\/blog.galsoft.com.ar\/?p=263","title":{"rendered":"Configurar proxy en docker"},"content":{"rendered":"<p class=\"wp-block-paragraph\">Primero debemos saber si utilizamos systemd o no, lo podemos averiguar con el siguiente comando:<\/p>\n<p class=\"wp-block-paragraph\"><code>readlink -v<\/code> <code>\/sbin\/init<\/code><\/p>\n<p class=\"wp-block-paragraph\">o con el siguiente:<\/p>\n<p class=\"wp-block-paragraph\"><code>ps -p1 | grep &quot;init|upstart|systemd&quot;<\/code><\/p>\n<h4 class=\"wp-block-heading\">Configurar proxy para Docker en sistemas <strong>sin<\/strong> systemd<\/h4>\n<p class=\"wp-block-paragraph\">Debemos crear un fichero, si no existe ya, en \/etc\/sysconfig\/ , llamado \u2018docker\u2019<\/p>\n<p class=\"wp-block-paragraph\"><code>&lt;strong&gt;vi&lt;\/strong&gt; &lt;strong&gt;\/&lt;\/strong&gt;etc&lt;strong&gt;\/&lt;\/strong&gt;sysconfig&lt;strong&gt;\/&lt;\/strong&gt;docker<\/code><\/p>\n<p class=\"wp-block-paragraph\">Con la siguiente informaci\u00f3n, adaptada a nuestras necesidades:<\/p>\n<p class=\"wp-block-paragraph\"><code>HTTP_PROXY=&#039;http:\/\/user:password@proxy-host:proxy-port&#039;<\/code><br><code>HTTPS_PROXY=&#039;http:\/\/user:password@proxy-host:proxy-port&#039;<\/code><\/p>\n<p class=\"wp-block-paragraph\">Una vez hecho esto s\u00f3lo tenemos que reiniciar el servicio:<\/p>\n<p class=\"wp-block-paragraph\"><code>service docker restart<\/code><\/p>\n<h2 class=\"wp-block-heading\">Configurar proxy para Docker en sistemas con systemd<\/h2>\n<p class=\"wp-block-paragraph\">Create the required Docker folder named\u00a0<strong>docker.service.d<\/strong>.<\/p>\n<p class=\"wp-block-paragraph\"><code>mkdir -p \/etc\/systemd\/system\/docker.service.d<\/code><\/p>\n<p class=\"wp-block-paragraph\">Create the required Docker file named\u00a0<strong>proxy.conf<\/strong>.<\/p>\n<p class=\"wp-block-paragraph\"><code>touch \/etc\/systemd\/system\/docker.service.d\/proxy.conf<\/code><\/p>\n<p class=\"wp-block-paragraph\">Edit the Proxy configuration file from the Docker service.<\/p>\n<p class=\"wp-block-paragraph\"><code>vi \/etc\/systemd\/system\/docker.service.d\/proxy.conf<\/code><\/p>\n<p class=\"wp-block-paragraph\">If your proxy requires authentication, add the the following configuration to the Proxy file.<\/p>\n<p class=\"wp-block-paragraph\"><code>Environment=&quot;HTTP_PROXY=http:\/\/bruno:kamisama123@192.168.0.1:3128&quot;<\/code><br><code>Environment=&quot;HTTPS_PROXY=http:\/\/bruno:kamisama123@192.168.0.1:3128&quot;<\/code><br><code>Environment=&quot;NO_PROXY=&quot;localhost,127.0.0.1,::1&quot;<\/code><\/p>\n<p class=\"wp-block-paragraph\">In our example, we set the proxy server 192.168.10.1 using the 3128 port.<\/p>\n<p class=\"wp-block-paragraph\">In our example, we authenticate the Docker proxy access using the username bruno and the password kamisama123.<\/p>\n<p class=\"wp-block-paragraph\">If your proxy does not require authentication, use the following proxy configuration instead.<\/p>\n<p class=\"wp-block-paragraph\"><code>Environment=&quot;HTTP_PROXY=http:\/\/192.168.0.1:3128&quot;<\/code><br><code>Environment=&quot;HTTPS_PROXY=http:\/\/192.168.0.1:3128&quot;<\/code><br><code>Environment=&quot;NO_PROXY=&quot;localhost,127.0.0.1,::1&quot;<\/code><\/p>\n<p class=\"wp-block-paragraph\">In our example, we set the proxy server 192.168.10.1 using the 3128 port.<\/p>\n<p class=\"wp-block-paragraph\">Reload systemd manager configuration.<\/p>\n<p class=\"wp-block-paragraph\"><code>systemctl daemon-reload<\/code><\/p>\n<p class=\"wp-block-paragraph\">Restart the Docker service.<\/p>\n<p class=\"wp-block-paragraph\"><code>systemctl restart docker.service<\/code><\/p>\n<p class=\"wp-block-paragraph\">Congratulations! You have finished the Docker proxy configuration.<\/p>\n<p class=\"wp-block-paragraph\">Fuente: https:\/\/techexpert.tips\/es\/docker-es\/docker-configuracion-de-proxy-en-ubuntu-linux\/<\/p>","protected":false},"excerpt":{"rendered":"<p>Primero debemos saber si utilizamos systemd o no, lo podemos averiguar con el siguiente comando: readlink -v \/sbin\/init o con el siguiente: ps -p1 | grep &#8220;init|upstart|systemd&#8221; Configurar proxy para Docker en sistemas sin systemd Debemos crear un fichero, si no existe ya, en \/etc\/sysconfig\/ , llamado \u2018docker\u2019 <strong>vi<\/strong> <strong>\/<\/strong>etc<strong>\/<\/strong>sysconfig<strong>\/<\/strong>docker Con la siguiente informaci\u00f3n, adaptada [&hellip;]<\/p>","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"ocean_post_layout":"","ocean_both_sidebars_style":"","ocean_both_sidebars_content_width":0,"ocean_both_sidebars_sidebars_width":0,"ocean_sidebar":"","ocean_second_sidebar":"","ocean_disable_margins":"enable","ocean_add_body_class":"","ocean_shortcode_before_top_bar":"","ocean_shortcode_after_top_bar":"","ocean_shortcode_before_header":"","ocean_shortcode_after_header":"","ocean_has_shortcode":"","ocean_shortcode_after_title":"","ocean_shortcode_before_footer_widgets":"","ocean_shortcode_after_footer_widgets":"","ocean_shortcode_before_footer_bottom":"","ocean_shortcode_after_footer_bottom":"","ocean_display_top_bar":"default","ocean_display_header":"default","ocean_header_style":"","ocean_center_header_left_menu":"","ocean_custom_header_template":"","ocean_custom_logo":0,"ocean_custom_retina_logo":0,"ocean_custom_logo_max_width":0,"ocean_custom_logo_tablet_max_width":0,"ocean_custom_logo_mobile_max_width":0,"ocean_custom_logo_max_height":0,"ocean_custom_logo_tablet_max_height":0,"ocean_custom_logo_mobile_max_height":0,"ocean_header_custom_menu":"","ocean_menu_typo_font_family":"","ocean_menu_typo_font_subset":"","ocean_menu_typo_font_size":0,"ocean_menu_typo_font_size_tablet":0,"ocean_menu_typo_font_size_mobile":0,"ocean_menu_typo_font_size_unit":"px","ocean_menu_typo_font_weight":"","ocean_menu_typo_font_weight_tablet":"","ocean_menu_typo_font_weight_mobile":"","ocean_menu_typo_transform":"","ocean_menu_typo_transform_tablet":"","ocean_menu_typo_transform_mobile":"","ocean_menu_typo_line_height":0,"ocean_menu_typo_line_height_tablet":0,"ocean_menu_typo_line_height_mobile":0,"ocean_menu_typo_line_height_unit":"","ocean_menu_typo_spacing":0,"ocean_menu_typo_spacing_tablet":0,"ocean_menu_typo_spacing_mobile":0,"ocean_menu_typo_spacing_unit":"","ocean_menu_link_color":"","ocean_menu_link_color_hover":"","ocean_menu_link_color_active":"","ocean_menu_link_background":"","ocean_menu_link_hover_background":"","ocean_menu_link_active_background":"","ocean_menu_social_links_bg":"","ocean_menu_social_hover_links_bg":"","ocean_menu_social_links_color":"","ocean_menu_social_hover_links_color":"","ocean_disable_title":"default","ocean_disable_heading":"default","ocean_post_title":"","ocean_post_subheading":"","ocean_post_title_style":"","ocean_post_title_background_color":"","ocean_post_title_background":0,"ocean_post_title_bg_image_position":"","ocean_post_title_bg_image_attachment":"","ocean_post_title_bg_image_repeat":"","ocean_post_title_bg_image_size":"","ocean_post_title_height":0,"ocean_post_title_bg_overlay":0.5,"ocean_post_title_bg_overlay_color":"","ocean_disable_breadcrumbs":"default","ocean_breadcrumbs_color":"","ocean_breadcrumbs_separator_color":"","ocean_breadcrumbs_links_color":"","ocean_breadcrumbs_links_hover_color":"","ocean_display_footer_widgets":"default","ocean_display_footer_bottom":"default","ocean_custom_footer_template":"","ocean_post_oembed":"","ocean_post_self_hosted_media":"","ocean_post_video_embed":"","ocean_link_format":"","ocean_link_format_target":"self","ocean_quote_format":"","ocean_quote_format_link":"post","ocean_gallery_link_images":"on","ocean_gallery_id":[],"footnotes":""},"categories":[11,1,13],"tags":[],"class_list":["post-263","post","type-post","status-publish","format-standard","hentry","category-docker","category-linux","category-webs-utiles","entry"],"_links":{"self":[{"href":"https:\/\/blog.galsoft.com.ar\/index.php?rest_route=\/wp\/v2\/posts\/263","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/blog.galsoft.com.ar\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/blog.galsoft.com.ar\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/blog.galsoft.com.ar\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/blog.galsoft.com.ar\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=263"}],"version-history":[{"count":8,"href":"https:\/\/blog.galsoft.com.ar\/index.php?rest_route=\/wp\/v2\/posts\/263\/revisions"}],"predecessor-version":[{"id":1374,"href":"https:\/\/blog.galsoft.com.ar\/index.php?rest_route=\/wp\/v2\/posts\/263\/revisions\/1374"}],"wp:attachment":[{"href":"https:\/\/blog.galsoft.com.ar\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=263"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/blog.galsoft.com.ar\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=263"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/blog.galsoft.com.ar\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=263"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}