Code Server Port Bind Issue

If you want to change the port Code Server uses, it’s hard-coded into the /etc/services.d/code-server/run script, as a value for the --bind-addr flag.

#!/usr/bin/with-contenv bash

if [ -n "${PASSWORD}" ] || [ -n "${HASHED_PASSWORD}" ]; then
    AUTH="password"
else
    AUTH="none"
    echo "starting with no password"
fi

if [ -z ${PROXY_DOMAIN+x} ]; then
    PROXY_DOMAIN_ARG=""
else
    PROXY_DOMAIN_ARG="--proxy-domain=${PROXY_DOMAIN}"
fi

exec \
    s6-setuidgid abc \
        /app/code-server/bin/code-server \
            --bind-addr 0.0.0.0:8088 \
            --user-data-dir /config/data \
            --extensions-dir /config/extensions \
            --disable-telemetry \
            --auth "${AUTH}" \
            "${PROXY_DOMAIN_ARG}" \
            "${DEFAULT_WORKSPACE:-/config/workspace}"

I mount the file in Docker Compose so I can override --bind-addr:

    volumes:
      - ./run:/etc/services.d/code-server/run

About

I'm a technology professional who's been passionate about computers since my Grandad introduced me to an Intel 386 back in the 90s when I was a kid. Those moments inspired a passion within for technology, and I've been playing around with anything with a circuit board ever since. Whenever I have a moment you can probably find me working on something computer-related, and this is where I like to write about those moments.