Shell/Bash: how to expose docker api over tcp Example


Shell/Bash Example: This is the "how to expose docker api over tcp" Example. compiled from many sources on the internet by

how to expose docker api over tcp

## Use the command sudo systemctl edit docker.service
## to open an override file for docker.service in a text editor and
## add below  lines(this is for testing purpose only,
##while PROD access or expose Docker api through tls or a proxy)
$ sudo systemctl edit docker.service
#ExecStart=/usr/bin/dockerd -H fd:// -H tcp://
ExecStart=/usr/bin/dockerd -H fd:// -H tcp://

#Reload the systemctl configuration.

$ sudo systemctl daemon-reload

#Restart Docker.

$ sudo systemctl restart docker.service

#Check to see whether the change was honored by reviewing the 
#output of netstat to confirm dockerd is listening on the configured port.

$ sudo netstat -lntp | grep dockerd
tcp        0      0*               LISTEN      3758/dockerd

$ sudo docker -H tcp://:2375 ps

* Summary: This "how to expose docker api over tcp" Shell/Bash Example is compiled from the internet. If you have any questions, please leave a comment. Thank you!