Restrict Internet Access - Docker Container - Stack Overflow (https://cdn.sstatic.net/Sites/stackoverflow/Img/favicon.ico?v=ec617d715196) (https://cdn.sstatic.net/Sites/stackoverflow/Img/apple-touch-icon.png?v=c78bd457575a) (https://cdn.sstatic.net/Sites/stackoverflow/Img/apple-touch-icon.png?v=c78bd457575a) (Stack Overflow) (/opensearch.xml) (https://stackoverflow.com/questions/39913757/restrict-internet-access-docker-container) (https://cdn.sstatic.net/Shared/stacks.css?v=bd2aba62c5a4) (https://cdn.sstatic.net/Sites/stackoverflow/primary.css?v=7d8876444382) (Feed for question 'Restrict Internet Access - Docker Container') (/feeds/question/39913757) (https://cdn.sstatic.net/Shared/Channels/channels.css?v=5981bb1a5bd7) (https://accounts.google.com/gsi/style) (site logo) Join Stack Overflow By clicking “Sign up”, you agree to our (/legal/terms-of-service/public) terms of service and acknowledge you have read our (/legal/privacy-policy) privacy policy . (9b9d1ff1208457cf29de4d03e17fc06b55f301e0c5c48e7398c73e63b318268a) (1) (2.0) Sign up with Google Sign up with GitHub OR (9b9d1ff1208457cf29de4d03e17fc06b55f301e0c5c48e7398c73e63b318268a) (1) () () () () () () Email Password (8+ characters (at least 1 letter & 1 number)) Sign up Already have an account? (/users/login) Log in (9b9d1ff1208457cf29de4d03e17fc06b55f301e0c5c48e7398c73e63b318268a) () Skip to main content (https://stackoverflow.com) Stack Overflow (https://stackoverflow.co/) About Products (https://stackoverflow.co/teams/ai/?utm_medium=referral&utm_source=stackoverflow-community&utm_campaign=top-nav-bar&utm_content=overflowai) OverflowAI (https://stackoverflow.co/teams/?utm_medium=referral&utm_source=stackoverflow-community&utm_campaign=top-nav&utm_content=stack-overflow-for-teams) Stack Overflow for Teams Where developers & technologists share private knowledge with coworkers (https://stackoverflow.co/advertising/?utm_medium=referral&utm_source=stackoverflow-community&utm_campaign=top-nav&utm_content=stack-overflow-advertising) Advertising & Talent Reach devs & technologists worldwide about your product, service or employer brand (https://stackoverflow.co/teams/ai/?utm_medium=referral&utm_source=stackoverflow-community&utm_campaign=top-nav&utm_content=overflow-ai) OverflowAI GenAI features for Teams (https://stackoverflow.co/api-solutions/?utm_medium=referral&utm_source=stackoverflow-community&utm_campaign=top-nav&utm_content=overflow-api) OverflowAPI Train & fine-tune LLMs (https://stackoverflow.co/labs/?utm_medium=referral&utm_source=stackoverflow-community&utm_campaign=top-nav&utm_content=labs) Labs The future of collective knowledge sharing (https://stackoverflow.co/?utm_medium=referral&utm_source=stackoverflow-community&utm_campaign=top-nav&utm_content=about-the-company) About the company (https://stackoverflow.blog/?utm_medium=referral&utm_source=stackoverflow-community&utm_campaign=top-nav&utm_content=blog) Visit the blog (Search…) () Loading… (https://stackoverflow.com) current community (https://stackoverflow.com) (Stack Overflow) Stack Overflow (https://stackoverflow.com/help) help (https://chat.stackoverflow.com/?tab=site&host=stackoverflow.com) chat (https://meta.stackoverflow.com) (Meta Stack Overflow) Meta Stack Overflow your communities (https://stackoverflow.com/users/signup?ssrc=site_switcher&returnurl=https%3a%2f%2fstackoverflow.com%2fquestions%2f39913757%2frestrict-internet-access-docker-container) Sign up or (https://stackoverflow.com/users/login?ssrc=site_switcher&returnurl=https%3a%2f%2fstackoverflow.com%2fquestions%2f39913757%2frestrict-internet-access-docker-container) log in to customize your list. (https://stackexchange.com/sites) more stack exchange communities (https://stackoverflow.blog) company blog (Click to show search) (https://stackoverflow.com/users/login?ssrc=head&returnurl=https%3a%2f%2fstackoverflow.com%2fquestions%2f39913757%2frestrict-internet-access-docker-container) Log in (https://stackoverflow.com/users/signup?ssrc=head&returnurl=https%3a%2f%2fstackoverflow.com%2fquestions%2f39913757%2frestrict-internet-access-docker-container) Sign up Let's set up your homepage Select a few topics you're interested in: python javascript c# reactjs java android html flutter c++ node.js typescript css r php angular next.js spring-boot machine-learning sql excel ios azure docker Or search from our full list: (Search) javascript python java c# php android html jquery c++ css ios sql mysql r reactjs node.js arrays c asp.net json python-3.x .net ruby-on-rails sql-server swift django angular objective-c excel pandas angularjs regex typescript ruby linux ajax iphone vba xml laravel spring asp.net-mvc database wordpress string flutter postgresql mongodb wpf windows amazon-web-services xcode bash git oracle-database spring-boot dataframe azure firebase list multithreading docker vb.net react-native eclipse algorithm powershell macos visual-studio numpy image forms scala function vue.js performance twitter-bootstrap selenium winforms kotlin loops express dart hibernate sqlite matlab python-2.7 shell rest apache entity-framework android-studio csv maven api linq qt dictionary unit-testing facebook asp.net-core tensorflow apache-spark file swing class unity-game-engine sorting date authentication go symfony t-sql opencv matplotlib .htaccess google-chrome for-loop datetime codeigniter http perl validation sockets google-maps object uitableview xaml oop if-statement visual-studio-code cordova ubuntu web-services email android-layout github elasticsearch spring-mvc kubernetes selenium-webdriver ms-access user-interface parsing ggplot2 pointers machine-learning google-sheets c++11 security flask google-apps-script ruby-on-rails-3 templates nginx variables exception sql-server-2008 gradle debugging tkinter listview delphi jpa asynchronous pdf web-scraping haskell jsp ssl amazon-s3 google-cloud-platform jenkins testing xamarin wcf npm batch-file generics ionic-framework network-programming unix recursion google-app-engine mongoose visual-studio-2010 .net-core android-fragments assembly animation math next.js session svg hadoop intellij-idea curl django-models join laravel-5 rust winapi url heroku http-redirect tomcat google-cloud-firestore inheritance webpack keras image-processing gcc asp.net-mvc-4 web logging dom swiftui matrix pyspark actionscript-3 button post optimization firebase-realtime-database jquery-ui iis cocoa xpath d3.js javafx firefox internet-explorer xslt caching select asp.net-mvc-3 opengl events asp.net-web-api plot dplyr magento encryption search stored-procedures amazon-ec2 ruby-on-rails-4 memory canvas audio multidimensional-array jsf random vector cookies redux facebook-graph-api input flash xamarin.forms indexing arraylist ipad cocoa-touch data-structures video apache-kafka model-view-controller serialization jdbc woocommerce routes razor azure-devops awk servlets mod-rewrite beautifulsoup docker-compose excel-formula iframe filter aws-lambda design-patterns text django-rest-framework visual-c++ cakephp mobile android-intent react-hooks struct methods groovy mvvm ssh lambda checkbox ecmascript-6 google-chrome-extension time grails installation sharepoint cmake shiny spring-security jakarta-ee android-recyclerview plsql core-data types meteor android-activity sed bootstrap-4 websocket activerecord graph replace scikit-learn file-upload group-by vim junit boost deep-learning import sass memory-management error-handling async-await dynamic eloquent soap silverlight dependency-injection charts layout apache-spark-sql deployment browser gridview svn while-loop google-bigquery vuejs2 ffmpeg dll highcharts view foreach plugins makefile c#-4.0 redis reporting-services jupyter-notebook merge server unicode https reflection google-maps-api-3 twitter oauth-2.0 extjs pytorch axios terminal pip split mysqli cmd django-views encoding database-design automation collections netbeans hash build data-binding ember.js tcp sqlalchemy pdo apache-flex concurrency entity-framework-core command-line spring-data-jpa printing java-8 react-redux jestjs service html-table neo4j lua ansible parameters module material-ui enums visual-studio-2012 promise flexbox outlook webview firebase-authentication web-applications uwp jquery-mobile utf-8 datatable python-requests parallel-processing drop-down-menu colors scroll hive tfs scipy count syntax ms-word twitter-bootstrap-3 ssis google-analytics fonts three.js constructor powerbi rxjs graphql file-io paypal discord cassandra socket.io graphics compiler-errors gwt react-router nlp solr url-rewriting backbone.js memory-leaks datatables oauth datagridview terraform drupal oracle11g zend-framework neural-network knockout.js triggers django-forms interface google-api angular-material casting jmeter linked-list path proxy timer django-templates arduino orm directory visual-studio-2015 parse-platform windows-phone-7 cron push-notification conditional-statements primefaces functional-programming pagination model jar xamarin.android hyperlink uiview visual-studio-2013 gitlab vbscript google-cloud-functions azure-active-directory jwt download swift3 sql-server-2005 configuration process rspec pygame properties combobox callback windows-phone-8 linux-kernel safari permissions scrapy raspberry-pi scripting emacs clojure x86 scope io compilation mongodb-query nhibernate responsive-design angularjs-directive expo request azure-functions bluetooth 3d dns binding reference discord.js architecture playframework version-control pyqt doctrine-orm package pycharm get sql-server-2012 rubygems f# autocomplete datepicker openssl kendo-ui tree jackson controller yii grep nested xamarin.ios static dockerfile statistics transactions datagrid null active-directory uiviewcontroller phpmyadmin webforms discord.py notifications sas computer-vision duplicates mocking youtube nullpointerexception yaml menu sum bitmap electron asp.net-mvc-5 visual-studio-2008 time-series blazor yii2 jsf-2 css-selectors stl android-listview floating-point cryptography ant stream hashmap character-encoding msbuild sdk asp.net-core-mvc google-drive-api selenium-chromedriver jboss joomla navigation cors devise anaconda background camera multiprocessing pyqt5 binary frontend cuda linq-to-sql iterator mariadb onclick plotly ios7 rabbitmq android-jetpack-compose android-asynctask microsoft-graph-api tabs laravel-4 insert uicollectionview environment-variables amazon-dynamodb linker console xsd coldfusion upload continuous-integration ftp textview opengl-es operating-system vuejs3 mockito localization xml-parsing macros formatting json.net kivy type-conversion data.table timestamp calendar integer segmentation-fault android-ndk drag-and-drop prolog char crash jasmine automated-tests dependencies geometry android-gradle-plugin itext firebase-cloud-messaging header fortran sprite-kit mfc attributes nuxt.js nosql format azure-pipelines nestjs odoo jquery-plugins db2 jenkins-pipeline leaflet event-handling postman flutter-layout julia annotations keyboard textbox arm visual-studio-2017 gulp libgdx stripe-payments xampp synchronization crystal-reports timezone dom-events azure-web-app-service android-emulator uikit swagger wso2 sequelize.js namespaces aggregation-framework uiscrollview jvm google-sheets-formula chart.js com subprocess geolocation webdriver centos html5-canvas widget dialog garbage-collection snowflake-cloud-data-platform numbers concatenation sql-update qml set windows-10 mapreduce tuples smtp ionic2 java-stream rotation modal-dialog spring-data android-edittext http-headers doctrine radio-button nuget grid sonarqube lucene xmlhttprequest internationalization listbox components initialization switch-statement google-play apache-camel boolean serial-port ldap ios5 youtube-api return gdb pivot eclipse-plugin latex frameworks tags containers github-actions dataset asp-classic subquery foreign-keys label copy uinavigationcontroller c++17 delegates google-cloud-storage struts2 migration base64 protractor find sql-server-2008-r2 queue uibutton embedded arguments composer-php append jaxb zip stack cucumber autolayout ide entity-framework-6 popup iteration airflow windows-7 r-markdown ssl-certificate vb6 tailwind-css gmail hover jqgrid g++ udp Next You’ll be prompted to create an account to view your personalized homepage. (/) Home (/questions) Questions (/tags) Tags (/users) Users (https://stackoverflow.com/jobs/companies?so_medium=stackoverflow&so_source=SiteNav) Companies Labs (/jobs?source=so-left-nav) Jobs (/beta/discussions) Discussions Collectives Communities for your favorite technologies. (/collectives-all) Explore all Collectives Teams () Ask questions, find answers and collaborate at work with Stack Overflow for Teams. (https://stackoverflowteams.com/teams/create/free/?utm_medium=referral&utm_source=stackoverflow-community&utm_campaign=side-bar&utm_content=explore-teams) Try Teams for free (https://stackoverflow.co/teams/?utm_medium=referral&utm_source=stackoverflow-community&utm_campaign=side-bar&utm_content=explore-teams) Explore Teams Teams Ask questions, find answers and collaborate at work with Stack Overflow for Teams. (https://stackoverflow.co/teams/?utm_medium=referral&utm_source=stackoverflow-community&utm_campaign=side-bar&utm_content=explore-teams-compact) Explore Teams Collectives™ on Stack Overflow Find centralized, trusted content and collaborate around the technologies you use most. (/collectives) Learn more about Collectives Teams Q&A for work Connect and share knowledge within a single location that is structured and easy to search. (https://stackoverflow.co/teams/) Learn more about Teams Get early access and see previews of new features. (https://stackoverflow.co/labs/) Learn more about Labs (Illustration of upvote icon after it is clicked) Hang on, you can't upvote just yet. You'll need to complete a few actions and gain 15 reputation points before being able to upvote. Upvoting indicates when questions and answers are useful. (https://stackoverflow.com/help/whats-reputation) What's reputation and how do I get it? Instead, you can save this post to reference later. Save this post for later Not now (https://cdn.sstatic.net/Sites/stackoverflow/Img/apple-touch-icon.png?v=c78bd457575a) (/questions/39913757/restrict-internet-access-docker-container) Restrict Internet Access - Docker Container (/questions/ask) Ask Question (2016-10-07 09:20:40Z) Asked 8 years, 5 months ago Modified (?lastactivity) (2023-03-24 15:40:09Z) 1 year, 11 months ago (Viewed 80,742 times) Viewed 81k times This question shows research effort; it is useful and clear (70:3:31e,16:853e675c50e76187,10:1742105814,16:c089cec0f72de9ec,8:39913757,0197fec2a1a060dae82e0735bb830b10791806c4d2743302c016ab0ccf591198) 92 (This question does not show any research effort; it is unclear or not useful) (70:3:31e,16:5778f18be61d5bde,10:1742105814,16:d6e9cd11307b9b06,8:39913757,78f7d7feab116810ded5d00c233761b1f78f8ceb929555f7a2100485887e5e59) Save this question. (/posts/39913757/timeline) Show activity on this post. I have a situation to restrict internet access of the container in load balancer network. for example in that below picture (https://i.sstatic.net/tChKt.png) (easy for your reference) Only container4 connects to the Internet; other three only communicate through container4 with the outside world. For example if container1 needs smtp support, it will forward smtp request to container4 to get access. No container other than container4 should be allowed to access the Internet directly! This should be enforced on Docker level. I believe it will be configurable on docker network creation , can any one explain how to achieve this? (/questions/tagged/docker) (show questions tagged 'docker') docker (/questions/tagged/docker-network) (show questions tagged 'docker-network') docker-network (/q/39913757) (Short permalink to this question) Share Share a link to this question Copy link (https://creativecommons.org/licenses/by-sa/3.0/) (The current license for this post: CC BY-SA 3.0) CC BY-SA 3.0 (/posts/39913757/edit) () Improve this question Follow (70:3:31e,16:7130e4f3ee0ba210,10:1742105814,16:641c01923c3ef33b,8:39913757,71443c55f8fb7d05747eed4cd01d20dd0615c4df0c9394ed74520ec1b3f7e7c3) Follow this question to receive notifications (/posts/39913757/revisions) (show all edits to this post) edited (2017-02-19 16:59:24Z) Feb 19, 2017 at 16:59 (/users/2263517/knaperek) (knaperek's user avatar) (/users/2263517/knaperek) knaperek (reputation score) 2,253 (26 silver badges) 26 26 silver badges (42 bronze badges) 42 42 bronze badges asked (2016-10-07 09:20:40Z) Oct 7, 2016 at 9:20 (/users/5528059/bilal-usean) (Bilal Usean's user avatar) (/users/5528059/bilal-usean) Bilal Usean Bilal Usean (reputation score) 2,474 (3 gold badges) 3 3 gold badges (25 silver badges) 25 25 silver badges (51 bronze badges) 51 51 bronze badges (Use comments to ask for more information or suggest improvements. Avoid answering questions in comments.) Add a comment | (Expand to show all comments on this post) 5 Answers 5 Sorted by: (/questions/39913757/restrict-internet-access-docker-container?answertab=scoredesc#tab-top) Reset to default (scoredesc) Highest score (default) (trending) Trending (recent votes count more) (modifieddesc) Date modified (newest first) (createdasc) Date created (oldest first) This answer is useful (70:3:31e,16:4918c73d759810fd,10:1742105814,16:e4bfad344cae8873,8:51964169,336e15a1c60dbc7558013e2b17f711326af0cf91f5c87ded8501bb8889991b48) 113 (This answer is not useful) (70:3:31e,16:afd03197c88de054,10:1742105814,16:3364005c6db743f8,8:51964169,c413ebe79215d50d6888b922433c25f1763754ca08482a7b54c382952ed27942) Save this answer. (Loading when this answer was accepted…) (/posts/51964169/timeline) Show activity on this post. As found (https://forums.docker.com/t/internal-network-between-containers-without-external-network-access/41751/9) here , I got this to work with docker-compose. Save as docker-compose.yml : version: '3' services: outgoing-wont-work: image: alpine networks: - no-internet command: ping -c 3 google.com # will crash internal-will-work: image: alpine networks: - no-internet command: ping -c 3 internal-and-external internal-and-external: image: alpine networks: - no-internet - internet command: ping -c 3 google.com networks: no-internet: driver: bridge internal: true internet: driver: bridge Then run docker-compose up -d , docker-compose ps will show something like this after a few seconds: Name Command State Ports ---------------------------------------------------------------------------------- dco_inet_internal-and-external_1 ping -c 3 google.com Exit 0 dco_inet_internal-will-work_1 ping -c 3 internal-and-ext ... Exit 0 dco_inet_outgoing-wont-work_1 ping -c 3 google.com Exit 1 (/a/51964169) (Short permalink to this answer) Share Share a link to this answer Copy link (https://creativecommons.org/licenses/by-sa/4.0/) (The current license for this post: CC BY-SA 4.0) CC BY-SA 4.0 (/posts/51964169/edit) () Improve this answer Follow (70:3:31e,16:e790a094c97ee7ee,10:1742105814,16:b8b082baec46ef89,8:51964169,9d8087b707b88d8850e0614f88aae1e299a1a7594e8b8de58e3dcdc82b75418e) Follow this answer to receive notifications (/posts/51964169/revisions) (show all edits to this post) edited (2019-03-19 16:16:05Z) Mar 19, 2019 at 16:16 answered (2018-08-22 09:51:06Z) Aug 22, 2018 at 9:51 (/users/332451/exic) (exic's user avatar) (/users/332451/exic) exic exic (reputation score) 2,698 (2 gold badges) 2 2 gold badges (26 silver badges) 26 26 silver badges (30 bronze badges) 30 30 bronze badges 1 (number of 'useful comment' votes received) 3 I wish this worked for me. We're running Traefik as a reverse proxy in front of the application containers and Squid as a proxy for outgoing HTTP(S) requests from the application container to the internet. I tried your solution but the app container still has access to the internet, I think through the network it shares with Traefik. – (/users/14027/tobias) (5,108 reputation) Tobias Commented (2021-09-02 16:52:46Z, License: CC BY-SA 4.0) Sep 2, 2021 at 16:52 (Use comments to ask for more information or suggest improvements. Avoid comments like “+1” or “thanks”.) Add a comment | (Expand to show all comments on this post) This answer is useful (70:3:31e,16:132ed15a60e80ba0,10:1742105814,16:d8d5d60fdacd842a,8:42336592,a64bcdabdb683025221c0bc9a53c3162988b12825a96047237449595554cd589) 49 (This answer is not useful) (70:3:31e,16:bbc563f73630bf44,10:1742105814,16:90f10895efcf9902,8:42336592,e2eeda6358d82ed778e22f2879e1e7e8845c7806bce5c65d7ce0a356b33a5a3b) Save this answer. (Loading when this answer was accepted…) (/posts/42336592/timeline) Show activity on this post. Network creation for access internet docker network create --subnet=172.19.0.0/16 internet Network creation for block internet access docker network create --internal --subnet 10.1.1.0/24 no-internet If you want to connect docker container into internet docker network connect internet container-name If you want to block internet access docker network connect no-internet container-name Note in internal network we can't expose ports to connect outside world, please refer this (https://stackoverflow.com/q/40059375/5528059) question for more details (/a/42336592) (Short permalink to this answer) Share Share a link to this answer Copy link (https://creativecommons.org/licenses/by-sa/3.0/) (The current license for this post: CC BY-SA 3.0) CC BY-SA 3.0 (/posts/42336592/edit) () Improve this answer Follow (70:3:31e,16:767ecd8ee88cf609,10:1742105814,16:999b68c2f70d210e,8:42336592,4d87a9caf7299bfbf3f53fd8a1959cb264a70ce363b06b91b13f91f490d193fe) Follow this answer to receive notifications (/posts/42336592/revisions) (show all edits to this post) edited (2017-05-23 11:46:27Z) May 23, 2017 at 11:46 (/users/-1/community) (Community's user avatar) (/users/-1/community) Community (Community Bot — not a real person. Replies to this bot are not monitored.) Bot (reputation score) 1 (1 silver badge) 1 1 silver badge answered (2017-02-20 04:33:46Z) Feb 20, 2017 at 4:33 (/users/5528059/bilal-usean) (Bilal Usean's user avatar) (/users/5528059/bilal-usean) Bilal Usean Bilal Usean (reputation score) 2,474 (3 gold badges) 3 3 gold badges (25 silver badges) 25 25 silver badges (51 bronze badges) 51 51 bronze badges 5 (number of 'useful comment' votes received) 14 Do you know how to configure this with Docker Compose? – (/users/2263517/knaperek) (2,253 reputation) knaperek Commented (2017-02-24 13:01:28Z, License: CC BY-SA 3.0) Feb 24, 2017 at 13:01 I don't know @JozefKnaperek – (/users/5528059/bilal-usean) (2,474 reputation) Bilal Usean Commented (2017-02-24 13:05:59Z, License: CC BY-SA 3.0) Feb 24, 2017 at 13:05 The containers on the no-internet network will still be able to make DNS queries; read (https://docs.docker.com/engine/userguide/networking/configure-dns/) this – (/users/1290953/bharat-khatri) (1,417 reputation) Bharat Khatri Commented (2018-01-27 15:49:20Z, License: CC BY-SA 3.0) Jan 27, 2018 at 15:49 (number of 'useful comment' votes received) 1 @BharatKhatri Yeah, but not through the internet. – (/users/1159643/spooky) (3,013 reputation) Spooky Commented (2018-03-25 09:28:57Z, License: CC BY-SA 3.0) Mar 25, 2018 at 9:28 (number of 'useful comment' votes received) 2 @JozefKnaperek see my answer for a solution with docker-compose. – (/users/332451/exic) (2,698 reputation) exic Commented (2018-08-22 09:51:44Z, License: CC BY-SA 4.0) Aug 22, 2018 at 9:51 (Use comments to ask for more information or suggest improvements. Avoid comments like “+1” or “thanks”.) Add a comment | (Expand to show all comments on this post) This answer is useful (70:3:31e,16:6ef3083301713352,10:1742105814,16:f1e0fe8c918654d3,8:64464693,be751c728e7de6dafa8473144fb0bb0879a3b9080097799e92d278d0b08ba7be) 10 (This answer is not useful) (70:3:31e,16:960bfce0b7efae44,10:1742105814,16:b1fd8a12f2d38a00,8:64464693,3f10cb46abbc13aec3637396cf7fa3f58f1bf8bb718c34cf68cfa2b050d2c058) Save this answer. (Loading when this answer was accepted…) (/posts/64464693/timeline) Show activity on this post. As stated in Bilal's answer, the internal network is a good solution if you do not need to expose the ports. If you do need to expose the ports, the below solution using iptables does the job for my requirements: docker network create --subnet 172.19.0.0/16 no-internet sudo iptables --insert DOCKER-USER -s 172.19.0.0/16 -j REJECT --reject-with icmp-port-unreachable sudo iptables --insert DOCKER-USER -s 172.19.0.0/16 -m state --state RELATED,ESTABLISHED -j RETURN Then add --network no-internet when you run your docker container. For instance: $ docker run -it --network no-internet ubuntu:focal /bin/bash root@9f2181f79985:/# apt update Err:1 http://archive.ubuntu.com/ubuntu focal InRelease Temporary failure resolving 'archive.ubuntu.com' (/a/64464693) (Short permalink to this answer) Share Share a link to this answer Copy link (https://creativecommons.org/licenses/by-sa/4.0/) (The current license for this post: CC BY-SA 4.0) CC BY-SA 4.0 (/posts/64464693/edit) () Improve this answer Follow (70:3:31e,16:d90f897d658398b6,10:1742105814,16:437325d268acc0da,8:64464693,3c5f25665c8e415abab2cb06c8abeac0a2a9fe5a3db631d9007d9d3bffa31062) Follow this answer to receive notifications answered (2020-10-21 13:33:17Z) Oct 21, 2020 at 13:33 (/users/5788959/beledouxdenis) (beledouxdenis's user avatar) (/users/5788959/beledouxdenis) beledouxdenis beledouxdenis (reputation score) 221 (3 silver badges) 3 3 silver badges (5 bronze badges) 5 5 bronze badges 2 Do you know how to do this on windows host machine? – (/users/5173201/dkregen) (477 reputation) dkregen Commented (2021-12-11 04:03:57Z, License: CC BY-SA 4.0) Dec 11, 2021 at 4:03 (number of 'useful comment' votes received) 1 I can confirm this works, so thank you! 2 questions: 1) Why does the REJECT come before the RELATED,ESTABLISHED line? Doesn't this order mean that REJECT takes precedence and renders latter rule useless? 2) Why icmp-port-unreachable for the reject reason? – (/users/2506135/john-lee) (1,141 reputation) John Lee Commented (2022-03-03 15:43:32Z, License: CC BY-SA 4.0) Mar 3, 2022 at 15:43 (Use comments to ask for more information or suggest improvements. Avoid comments like “+1” or “thanks”.) Add a comment | (Expand to show all comments on this post) This answer is useful (70:3:31e,16:34fcedfa448aaee4,10:1742105814,16:bb53b8517d539e72,8:61243361,4872632ccd91ffffcb6fda53d99f823cb1b4145ef27b9b483b10bd2aae1cabfa) 4 (This answer is not useful) (70:3:31e,16:44ee21e37ddd0099,10:1742105814,16:1a913ddc4aa7fc20,8:61243361,5bc04d4cc200accca06b8d2847919f508c979bcf831188ad7b41fe717d6314ac) Save this answer. (Loading when this answer was accepted…) (/posts/61243361/timeline) Show activity on this post. Another option, if you need to expose ports on a container without internet access, but want to let it talk to other containers would be to provide a bogus DNS configuration. This isn't a perfect solution though, since it doesn't prevent direct IP access to the outside world. docker-compose.yaml version: '3' services: service1: image: alpine command: sh -c 'ping service2 -c 1; ping google.com -c 1' dns: 0.0 .0 .0 service2: image: alpine command: sh -c 'ping service1 -c 1; ping google.com -c 1' dns: 0.0 .0 .0 isolated> docker-compose up Recreating isolated_service1_1 ... done Recreating isolated_service2_1 ... done Attaching to isolated_service2_1, isolated_service1_1 service1_1 | PING service2 (172.18.0.2) 56(84) bytes of data. service1_1 | 64 bytes from isolated_service2_1.isolated_default (172.18.0.2): icmp_seq=1 ttl=64 time=0.038 ms service1_1 | service1_1 | --- service2 ping statistics --- service1_1 | 1 packets transmitted, 1 received, 0% packet loss, time 0ms service1_1 | rtt min/avg/max/mdev = 0.038/0.038/0.038/0.000 ms service2_1 | PING service1 (172.18.0.3) 56(84) bytes of data. service2_1 | 64 bytes from isolated_service1_1.isolated_default (172.18.0.3): icmp_seq=1 ttl=64 time=0.093 ms service2_1 | service2_1 | --- service1 ping statistics --- service2_1 | 1 packets transmitted, 1 received, 0% packet loss, time 0ms service2_1 | rtt min/avg/max/mdev = 0.093/0.093/0.093/0.000 ms service1_1 | ping: google.com: Temporary failure in name resolution service2_1 | ping: google.com: Temporary failure in name resolution isolated_service1_1 exited with code 2 isolated_service2_1 exited with code 2 (/a/61243361) (Short permalink to this answer) Share Share a link to this answer Copy link (https://creativecommons.org/licenses/by-sa/4.0/) (The current license for this post: CC BY-SA 4.0) CC BY-SA 4.0 (/posts/61243361/edit) () Improve this answer Follow (70:3:31e,16:6d666451e1a8d0fd,10:1742105814,16:83a1e8ef765b1cdd,8:61243361,1915781f7e2fb968edf3650e7a14e458bb73c851ae470ddd11bac78c33183e3a) Follow this answer to receive notifications answered (2020-04-16 05:34:36Z) Apr 16, 2020 at 5:34 (/users/160256/keegan) (Keegan's user avatar) (/users/160256/keegan) Keegan Keegan (reputation score 12,247) 12.2k (1 gold badge) 1 1 gold badge (30 silver badges) 30 30 silver badges (38 bronze badges) 38 38 bronze badges 3 It isn't perfect but yes it might mitigate most of internet access attempts from softwares. – (/users/4958081/secavfr) (973 reputation) secavfr Commented (2020-05-08 13:43:34Z, License: CC BY-SA 4.0) May 8, 2020 at 13:43 (number of 'useful comment' votes received) 5 I would like to disagree it dose not restrict anything and therefor so far from perfect... – (/users/8055836/lenard) (173 reputation) Lenard Commented (2020-07-18 22:01:32Z, License: CC BY-SA 4.0) Jul 18, 2020 at 22:01 This works well for requests that require DNS resolution and is a good workaround for cases where the network based restriction isn't feasible. Our setup involves a Traefik instance in front of the application container and in that case, the other solutions don't seem to work. – (/users/14027/tobias) (5,108 reputation) Tobias Commented (2021-09-02 16:50:49Z, License: CC BY-SA 4.0) Sep 2, 2021 at 16:50 (Use comments to ask for more information or suggest improvements. Avoid comments like “+1” or “thanks”.) Add a comment | (Expand to show all comments on this post) This answer is useful (70:3:31e,16:f79a2f92ecacd639,10:1742105814,16:31b4dc51d9baafac,8:75835572,ad64a82ea56cea4ee99f73f5d4a981522d8d39eb3f877fa62a578d920859d2ca) 3 (This answer is not useful) (70:3:31e,16:548f388880e3f9e1,10:1742105814,16:1bd1783adbc6140c,8:75835572,a83031c0658f2387b243c500a4b556a111c2ff26edc93576555b978f6c078cf2) Save this answer. (Loading when this answer was accepted…) (/posts/75835572/timeline) Show activity on this post. For blocking outgoing (internet) while exposing ports to the internal LAN network --internal or internal:true does not allow exposing ports to the internal network. backup your current rules sudo iptables-save > iptables.backup (optional) flush your existing rules under DOCKER-USER sudo iptables -F DOCKER-USER add these rules in this order (assuming the docker IP range is 10.0.1.0/24 ) sudo iptables -A DOCKER-USER -s 10.0.1.0/24 -d 192.168.0.0/16 -j RETURN sudo iptables -A DOCKER-USER -s 10.0.1.0/24 -d 172.16.0.0/12 -j RETURN sudo iptables -A DOCKER-USER -s 10.0.1.0/24 -d 10.0.0.0/8 -j RETURN sudo iptables -A DOCKER-USER -s 10.0.1.0/24 -j REJECT --reject-with icmp-port-unreachable sudo iptables -A DOCKER-USER -j RETURN sudo iptables --list --line-numbers should show: Chain DOCKER-USER (1 references) num target prot opt source destination 1 RETURN all -- 10.0.1.0/24 192.168.0.0/16 2 RETURN all -- 10.0.1.0/24 172.16.0.0/12 3 RETURN all -- 10.0.1.0/24 10.0.0.0/8 4 REJECT all -- 10.0.1.0/24 anywhere reject-with icmp-port-unreachable 5 RETURN all -- anywhere anywhere docker-compose.yml : networks: no_internet: driver: bridge ipam: config: - subnet: 10.0.1.0/24 services: some-service: image: some-image networks: - no_internet ports: - '123:123' (/a/75835572) (Short permalink to this answer) Share Share a link to this answer Copy link (https://creativecommons.org/licenses/by-sa/4.0/) (The current license for this post: CC BY-SA 4.0) CC BY-SA 4.0 (/posts/75835572/edit) () Improve this answer Follow (70:3:31e,16:4bdbde68543dd6fb,10:1742105814,16:a87bb4164fa2577a,8:75835572,d91352c2b12a7e77a11341bbeb8c91b8caac5e5e059d57d6dd7817756d8aa9d8) Follow this answer to receive notifications (/posts/75835572/revisions) (show all edits to this post) edited (2023-03-24 15:40:09Z) Mar 24, 2023 at 15:40 answered (2023-03-24 15:34:08Z) Mar 24, 2023 at 15:34 (/users/4764319/mastrchee) (mastrchee's user avatar) (/users/4764319/mastrchee) mastrchee mastrchee (reputation score) 31 (2 bronze badges) 2 2 bronze badges 1 gotcha: iptables does not survive reboots – (/users/1141876/fiat) (15,981 reputation) fiat Commented (2023-10-17 22:23:07Z, License: CC BY-SA 4.0) Oct 17, 2023 at 22:23 (Use comments to ask for more information or suggest improvements. Avoid comments like “+1” or “thanks”.) Add a comment | (Expand to show all comments on this post) (39913757) (false) () Your Answer (True) Thanks for contributing an answer to Stack Overflow! Please be sure to answer the question . Provide details and share your research! But avoid … Asking for help, clarification, or responding to other answers. Making statements based on opinion; back them up with references or personal experience. To learn more, see our (/help/how-to-answer) tips on writing great answers . Draft saved Draft discarded (9b9d1ff1208457cf29de4d03e17fc06b55f301e0c5c48e7398c73e63b318268a) Sign up or (/users/login?ssrc=question_page&returnurl=https%3a%2f%2fstackoverflow.com%2fquestions%2f39913757%2frestrict-internet-access-docker-container%23new-answer) log in Sign up using Google Sign up using Email and Password (false) (false) Submit Post as a guest Name () () Email Required, but never shown () () Post as a guest Name () () Email Required, but never shown () () Post Your Answer Discard By clicking “Post Your Answer”, you agree to our (https://stackoverflow.com/legal/terms-of-service/public) terms of service and acknowledge you have read our (https://stackoverflow.com/legal/privacy-policy) privacy policy .(1) Start asking to get answers Find the answer to your question by asking. (/questions/ask) Ask question Explore related questions (/questions/tagged/docker) (show questions tagged 'docker') docker (/questions/tagged/docker-network) (show questions tagged 'docker-network') docker-network See similar questions with these tags. The Overflow Blog (https://stackoverflow.blog/2025/03/14/can-climate-tech-startups-address-the-current-crisis/?cb=1) Can climate tech startups address the current crisis? (https://stackoverflow.blog/2025/03/14/what-we-learned-at-tdx-2025/?cb=1) What we learned at TDX 2025 Featured on Meta (Meta Stack Exchange) (https://meta.stackexchange.com/questions/407321/community-asks-sprint-announcement-march-2025?cb=1) Community Asks Sprint Announcement - March 2025 (Meta Stack Exchange) (https://meta.stackexchange.com/questions/407425/meta-stack-exchange-site-maintenance-scheduled-starting-monday-march-17-2025-f?cb=1) (Meta Stack Exchange site maintenance scheduled starting Monday, March 17, 2025 from 13:30 UTC to 14:30 UTC (9:30am to 10:30am ET)) Meta Stack Exchange site maintenance scheduled starting Monday, March 17,... (Meta Stack Overflow) (https://meta.stackoverflow.com/questions/432989/is-it-better-to-redirect-users-who-attempt-to-perform-actions-they-cant-yet-tak?cb=1) (Is it better to redirect users who attempt to perform actions they can't yet take?) Is it better to redirect users who attempt to perform actions they can't yet... (Meta Stack Overflow) (https://meta.stackoverflow.com/questions/433034/stacks-editor-development-and-testing?cb=1) Stacks Editor development and testing Linked (https://stackoverflow.com/q/61237950?lq=1) (Question score (upvotes - downvotes)) 2 (https://stackoverflow.com/questions/61237950/how-to-disable-external-network-calls-in-docker-compose?noredirect=1&lq=1) How to disable external network calls in docker compose? (https://stackoverflow.com/q/55067113?lq=1) (Question score (upvotes - downvotes)) 16 (https://stackoverflow.com/questions/55067113/this-node-is-not-a-swarm-manager-error-but-im-not-using-docker-swarm?noredirect=1&lq=1) "This node is not a swarm manager" error, but I'm not using docker swarm (https://stackoverflow.com/q/68457912?lq=1) (Question score (upvotes - downvotes)) 5 (https://stackoverflow.com/questions/68457912/docker-limit-outgoing-connections-to-the-localhost-only-while-allowing-all-inc?noredirect=1&lq=1) Docker: limit outgoing connections to the localhost only, while allowing all incoming connections (https://stackoverflow.com/q/40059375?lq=1) (Question score (upvotes - downvotes)) 3 (https://stackoverflow.com/questions/40059375/is-port-not-common-for-all-the-docker-networks?noredirect=1&lq=1) is port not common for all the docker networks? (https://stackoverflow.com/q/45798536?lq=1) (Question score (upvotes - downvotes)) 4 (https://stackoverflow.com/questions/45798536/restrict-docker-container-access-to-the-host-lan-but-not-to-internet?noredirect=1&lq=1) Restrict docker container access to the host LAN but not to internet (https://stackoverflow.com/q/45635331?lq=1) (Question score (upvotes - downvotes)) 4 (https://stackoverflow.com/questions/45635331/docker-how-to-prevent-outgoing-traffic-from-a-dockers-network-using-docker-com?noredirect=1&lq=1) Docker: How to prevent outgoing traffic from a docker's network using docker-compose and no iptables? (https://stackoverflow.com/q/65165332?lq=1) (Question score (upvotes - downvotes)) 3 (https://stackoverflow.com/questions/65165332/multi-platform-docker-internal-network-connect-from-host?noredirect=1&lq=1) Multi-Platform Docker Internal Network Connect From Host (https://stackoverflow.com/q/56431160?lq=1) (Question score (upvotes - downvotes)) 2 (https://stackoverflow.com/questions/56431160/no-internet-inside-docker-container-in-created-network?noredirect=1&lq=1) No internet inside docker container in created network (https://stackoverflow.com/q/53149892?lq=1) (Question score (upvotes - downvotes)) 2 (https://stackoverflow.com/questions/53149892/how-to-restrict-docker-container-access-to-other-containers-and-to-the-internet?noredirect=1&lq=1) How to restrict Docker container access to other containers and to the internet (expose port only for host)? (https://stackoverflow.com/q/45836739?lq=1) (Question score (upvotes - downvotes)) 0 (https://stackoverflow.com/questions/45836739/setup-multiple-ubuntu-container-using-docker?noredirect=1&lq=1) Setup multiple Ubuntu Container using Docker (https://stackoverflow.com/questions/linked/39913757?lq=1) See more linked questions Related (https://stackoverflow.com/q/28410432?rq=3) (Question score (upvotes - downvotes)) 3 (https://stackoverflow.com/questions/28410432/limit-network-access-but-allow-a-specific-ip-for-a-running-docker-container?rq=3) Limit Network access but allow a specific IP for a Running Docker Container (https://stackoverflow.com/q/38678714?rq=3) (Question score (upvotes - downvotes)) 2 (https://stackoverflow.com/questions/38678714/how-to-create-docker-restricted-network?rq=3) how to create docker restricted network (https://stackoverflow.com/q/47001200?rq=3) (Question score (upvotes - downvotes)) 15 (https://stackoverflow.com/questions/47001200/restrict-internet-access-to-docker-container?rq=3) Restrict internet access to docker container? (https://stackoverflow.com/q/47811217?rq=3) (Question score (upvotes - downvotes)) 10 (https://stackoverflow.com/questions/47811217/allow-docker-container-to-access-the-internet?rq=3) Allow docker container to access the internet (https://stackoverflow.com/q/52812543?rq=3) (Question score (upvotes - downvotes)) 0 (https://stackoverflow.com/questions/52812543/how-to-restrict-access-from-internet-to-containers-ports-on-remote-linux-server?rq=3) How to restrict access from internet to containers ports on remote linux server? (https://stackoverflow.com/q/54105432?rq=3) (Question score (upvotes - downvotes)) 2 (https://stackoverflow.com/questions/54105432/restrict-docker-container-internet-access?rq=3) Restrict docker container internet access (https://stackoverflow.com/q/63953333?rq=3) (Question score (upvotes - downvotes)) 2 (https://stackoverflow.com/questions/63953333/docker-restrict-container-network-access?rq=3) docker restrict container network access (https://stackoverflow.com/q/66108990?rq=3) (Question score (upvotes - downvotes)) 4 (https://stackoverflow.com/questions/66108990/make-docker-container-only-accessible-from-a-certain-ip?rq=3) Make docker container only accessible from a certain IP (https://stackoverflow.com/q/69544970?rq=3) (Question score (upvotes - downvotes)) 2 (https://stackoverflow.com/questions/69544970/how-to-prevent-internet-access-in-docker-containers?rq=3) How to prevent internet access in Docker containers (https://stackoverflow.com/q/72876279?rq=3) (Question score (upvotes - downvotes)) 0 (https://stackoverflow.com/questions/72876279/block-internet-access-from-docker-container?rq=3) Block Internet Access From Docker Container (https://stackexchange.com/questions?tab=hot) Hot Network Questions (Politics Stack Exchange) (https://politics.stackexchange.com/questions/91024/has-russia-ever-explained-its-u-turn-on-going-to-war-with-ukraine) Has Russia ever explained its U-turn on going to war with Ukraine? (TeX - LaTeX Stack Exchange) (https://tex.stackexchange.com/questions/739023/expansion-of-pgfplotsretval-in-node-contents-inside-foreach-loop) Expansion of \pgfplotsretval in node contents inside foreach loop (Latin Language Stack Exchange) (https://latin.stackexchange.com/questions/24526/how-do-we-know-that-venio-to-come-is-cognate-to-english-come-rather-than) How do we know that "venio" (to come) is cognate to English "come", rather than to English "wend"? (Mathematics Stack Exchange) (https://math.stackexchange.com/questions/5045737/if-a-subset-of-a-vector-space-is-also-a-vector-space-is-it-automatically-a-subs) If a subset of a vector space is also a vector space, is it automatically a subspace? (Law Stack Exchange) (https://law.stackexchange.com/questions/107792/what-are-the-legal-consequences-of-tesla-germany-holding-back-sick-employees-pa) What are the legal consequences of Tesla Germany holding back sick employees' pay? (TeX - LaTeX Stack Exchange) (https://tex.stackexchange.com/questions/739017/why-are-my-nodes-not-aligning) Why are my nodes not aligning? (Travel Stack Exchange) (https://travel.stackexchange.com/questions/193733/flying-from-germany-to-poland-and-back-without-schengen-visa) Flying from Germany to Poland and back without Schengen visa (Law Stack Exchange) (https://law.stackexchange.com/questions/107808/can-a-fulfilled-justified-anticipated-approval-of-a-crime-make-one-an-accomplice) Can a fulfilled justified anticipated approval of a crime make one an accomplice? (Role-playing Games Stack Exchange) (https://rpg.stackexchange.com/questions/214992/does-the-invisible-condition-mean-you-cannot-be-seen) Does the Invisible condition mean you cannot be seen? (Music: Practice & Theory Stack Exchange) (https://music.stackexchange.com/questions/139145/do-vocalists-tune-upward-as-do-instrumentalists-rather-than-downward) Do vocalists "tune upward" as do instrumentalists, rather than downward (Biblical Hermeneutics Stack Exchange) (https://hermeneutics.stackexchange.com/questions/102310/did-the-temple-soldiers-in-john-184-6-bow-or-get-knocked-down) Did the temple soldiers in John 18:4-6 bow or get knocked down? (Mathematics Stack Exchange) (https://math.stackexchange.com/questions/5045996/sequence-of-functions-with-iterative-derivation-prove-existence-of-limit) Sequence of functions with iterative derivation, prove existence of limit (Mathematica Stack Exchange) (https://mathematica.stackexchange.com/questions/311578/how-to-speed-up-tostring-texform) How to speed up ToString[#,TeXForm]&? (Role-playing Games Stack Exchange) (https://rpg.stackexchange.com/questions/214979/can-an-action-surging-7-eldritch-knight-cast-two-cantrips-with-war-magic) Can an Action Surging 7+ Eldritch Knight cast two cantrips with War Magic? (Worldbuilding Stack Exchange) (https://worldbuilding.stackexchange.com/questions/265297/can-a-single-country-simultaneously-suffer-from-overpopulation-and-underpopulati) Can a single country simultaneously suffer from overpopulation and underpopulation? (MathOverflow) (https://mathoverflow.net/questions/489412/can-prime-numbers-be-isolated-as-zeros-of-a-harmonic-wave-function) Can prime numbers be isolated as zeros of a harmonic wave function? (Aviation Stack Exchange) (https://aviation.stackexchange.com/questions/108198/why-starting-a-jet-engine-is-unrecommended-in-tailwind-conditions) Why starting a jet engine is unrecommended in tailwind conditions (Biblical Hermeneutics Stack Exchange) (https://hermeneutics.stackexchange.com/questions/102269/what-cultural-practice-did-jesus-have-in-mind-when-he-said-that-the-gates-of-ha) What cultural practice did Jesus have in mind when he said that "the gates of Hades will not prevail" in Matthew 16:18? (Electrical Engineering Stack Exchange) (https://electronics.stackexchange.com/questions/741495/a-problem-with-the-basics-of-opamps) A Problem with the Basics of OpAmps (Electrical Engineering Stack Exchange) (https://electronics.stackexchange.com/questions/741499/can-i-change-a-ferrite-core-to-a-slightly-larger-one-without-problems) Can I change a ferrite core to a slightly larger one without problems? (Quantum Computing Stack Exchange) (https://quantumcomputing.stackexchange.com/questions/41441/why-must-we-remove-garbage-for-interference-tests-graph-isomorphism-example) Why Must We Remove Garbage for Interference Tests? Graph Isomorphism example (Christianity Stack Exchange) (https://christianity.stackexchange.com/questions/105494/what-is-the-reasoning-that-leads-evangelicals-or-others-to-believe-attempting) What is the reasoning that leads Evangelicals (or others) to believe attempting to determine if a prominent figure is the Antichrist is acceptable? (Home Improvement Stack Exchange) (https://diy.stackexchange.com/questions/315818/can-i-use-tandem-breakers-to-make-room-in-a-full-panel-with-full-neutral-bus-bar) Can I use tandem breakers to make room in a full panel with full neutral bus bars? (Puzzling Stack Exchange) (https://puzzling.stackexchange.com/questions/130950/a-box-inside-a-box-puzzle) A box inside a box puzzle (/feeds/question/39913757) (Feed of this question and its answers) Question feed Subscribe to RSS Question feed To subscribe to this RSS feed, copy and paste this URL into your RSS reader. (https://stackoverflow.com/feeds/question/39913757) () (https://stackoverflow.com) (https://stackoverflow.com) Stack Overflow (/questions) Questions (/help) Help (https://chat.stackoverflow.com/?tab=site&host=stackoverflow.com) Chat (https://stackoverflow.co/) Products (https://stackoverflow.co/teams/?utm_medium=referral&utm_source=stackoverflow-community&utm_campaign=footer&utm_content=teams) Teams (https://stackoverflow.co/advertising/?utm_medium=referral&utm_source=stackoverflow-community&utm_campaign=footer&utm_content=advertising) Advertising (https://stackoverflow.co/advertising/employer-branding/?utm_medium=referral&utm_source=stackoverflow-community&utm_campaign=footer&utm_content=talent) Talent (https://stackoverflow.co/) Company (https://stackoverflow.co/) About (https://stackoverflow.co/company/press/) Press (https://stackoverflow.co/company/work-here/) Work Here (https://stackoverflow.com/legal) Legal (https://stackoverflow.com/legal/privacy-policy) Privacy Policy (https://stackoverflow.com/legal/terms-of-service/public) Terms of Service (/contact) Contact Us Your Privacy Choices (https://stackoverflow.com/legal/cookie-policy) Cookie Policy (https://stackexchange.com) Stack Exchange Network (https://stackexchange.com/sites#technology) Technology (https://stackexchange.com/sites#culturerecreation) Culture & recreation (https://stackexchange.com/sites#lifearts) Life & arts (https://stackexchange.com/sites#science) Science (https://stackexchange.com/sites#professional) Professional (https://stackexchange.com/sites#business) Business (https://api.stackexchange.com/) API (https://data.stackexchange.com/) Data (https://stackoverflow.blog?blb=1) Blog (https://www.facebook.com/officialstackoverflow/) Facebook (https://twitter.com/stackoverflow) Twitter (https://linkedin.com/company/stack-overflow) LinkedIn (https://www.instagram.com/thestackoverflow) Instagram Site design / logo © 2025 Stack Exchange Inc; user contributions licensed under (https://stackoverflow.com/help/licensing) CC BY-SA . rev 2025.3.14.23880 By clicking “Accept all cookies”, you agree Stack Exchange can store cookies on your device and disclose information in accordance with our (https://stackoverflow.com/legal/cookie-policy) Cookie Policy . Accept all cookies Necessary cookies only Customize settings