Prerequisites

What you need before you start, and how to get the Socket Firewall image from Docker Hub.

Everything on this page is needed before Stand up Socket Firewall for the first time.

Checklist

ItemRequirement
HostA Linux server or VM, x86_64 (amd64) or ARM64. macOS or Windows for local testing only
Container runtimeDocker 20.10 or later with Docker Compose 2.0 or later
Toolsopenssl, curl, jq
Socket accountAn organization with Socket Firewall Enterprise, and an API token with the packages:list and entitlements:list scopes
NetworkOutbound HTTPS to Docker Hub, api.socket.dev, fw.socket.dev, and the public registries; inbound HTTPS (443) from clients
Name and certificateA hostname for the firewall (examples use sfw.example.com) and a TLS certificate for it. A self-signed certificate is fine for a POC

Sizing

Allocate 4 CPUs when developer machines and CI install through the firewall directly. Allocate 2 CPUs when the firewall sits behind Artifactory or Nexus and sees only requests not cached by the artifact manager.

Memory requirements depend on whether metadata filtering is on. Allocate 1 GB per CPU with metadata filtering off. Allocate 2 GB per CPU with metadata filtering on.

DeploymentCPUsMemory, metadata filtering offMemory, metadata filtering on
Developers and CI install through the firewall44 GB8 GB
The firewall sits behind Artifactory or Nexus22 GB4 GB

Redis is optional and needs a 2 GB memory limit. Add that 2 GB to the firewall's memory when both run on one host. Details are in the Redis cache page.

Run more instances behind a load balancer and point them at one Redis to handle more traffic than one instance.

Throughput estimates for other sizes are in Resource-based recommendations. Sizing by team size for a firewall behind an artifact manager is in the Upstream Deployment Guide.

1. Install Docker and the tools

Ubuntu 22.04 / 24.04:

sudo apt update
sudo apt install -y docker.io docker-compose-v2 openssl curl jq
sudo usermod -aG docker "$USER"
newgrp docker      # or log out and back in

Other Linux distributions: follow Install Docker Engine for your distribution, which includes the Compose plugin, then install openssl, curl, and jq with your package manager.

macOS or Windows (local testing only): Docker Desktop includes Compose. Use a Linux host for anything other people will depend on.

Check the versions:

docker --version             # 20.10 or later
docker compose version       # v2.0 or later
🚧

Use docker compose, not docker-compose

The pages use the Compose v2 plugin (docker compose, with a space). The old standalone docker-compose (v1) is not supported.

2. Pull the firewall image

The image is published on Docker Hub as socketdev/socket-registry-firewall. It is public, so no Docker Hub login is needed.

docker pull socketdev/socket-registry-firewall:latest

latest is fine for a POC. For anything longer-lived, pin a version tag from the Docker Hub page and use the same tag in docker-compose.yml, so a restart never pulls an unexpected upgrade.

📘

Docker Hub rate limits

Anonymous pulls are rate-limited per IP address. If many machines share one outbound IP and pulls fail with toomanyrequests, run docker login with any Docker Hub account first.

Get the image on a restricted host

Pull on a machine that has access, then move the image:

# On the connected machine. Replace X.Y.Z with the version tag. Match the target's architecture: linux/amd64 or linux/arm64
docker pull --platform linux/amd64 socketdev/socket-registry-firewall:X.Y.Z
docker save socketdev/socket-registry-firewall:X.Y.Z -o socket-registry-firewall-X.Y.Z.tar

# Copy the .tar to the firewall host, then:
docker load -i socket-registry-firewall-X.Y.Z.tar

Or push it to your internal container registry and pull from there. The firewall still needs outbound HTTPS to fw.socket.dev, api.socket.dev and the upstream registries at runtime. If your policy requires building images yourself, see the tarball method in the Installation Guide.

The host has only the tag you loaded. Use that tag wherever these pages write latest: in the docker image inspect command under Verify on this page, and on the image: line of docker-compose.yml on the next page. Skip the hello-world check under Verify on this host because it pulls an image from Docker Hub.

3. Create the API token

Dashboard → Settings → API Tokens → create a token with these scopes:

  • packages:list
  • entitlements:list

This token goes in the firewall's .env on the next page. It doesn't need policy or admin scopes. The Policy config automation examples use a separate admin token.

4. Open the network paths

DirectionDestinationWhy
Outbound 443Docker Hub (registry-1.docker.io, auth.docker.io, production.cloudfront.docker.com)Pull the image. Not needed after the image is loaded
Outbound 443fw.socket.dev, api.socket.devVerdicts for every package. Required at all times
Outbound 443registry.npmjs.org, pypi.org, files.pythonhosted.org, and any other registry you routeFetch the packages themselves
Inbound 443From developer machines and CI runnersClients reach the firewall

If outbound traffic must go through a corporate proxy, see the outbound proxy settings in the Configuration Reference.

Verify

docker run --rm hello-world | grep -i "hello from docker"
docker compose version
docker image inspect socketdev/socket-registry-firewall:latest --format '{{.Architecture}}'
curl -sI https://fw.socket.dev | head -1
curl -sI https://api.socket.dev | head -1
curl -sI https://registry.npmjs.org | head -1
  • Docker runs a container without sudo
  • docker compose version shows v2 or later
  • The image is present, and its architecture matches the host (uname -m: x86_64 means amd64, aarch64 means arm64)
  • fw.socket.dev, api.socket.dev and the registries answer from the firewall host
  • You have the API token and a hostname for the firewall

Troubleshooting

SymptomFix
permission denied ... /var/run/docker.sockYour user isn't in the docker group yet. Run newgrp docker or log out and back in
docker: unknown command: docker compose or docker: 'compose' is not a docker commandThe Compose v2 plugin isn't installed. On Ubuntu, sudo apt install docker-compose-v2
toomanyrequests on pullDocker Hub rate limit. docker login, or pull once and distribute with docker save / docker load
exec format error when the container startsThe image architecture doesn't match the host. Pull with the right --platform
curl to fw.socket.dev or api.socket.dev times outEgress is blocked. Open outbound 443, or configure the outbound proxy

Next

Stand up Socket Firewall for the first time.


Did this page help you?