0

My team has been using docker-compose and nginx for a number of projects, and testing them using ubuntu servers.

We are looking into using github-codespaces, but notices that they have a number of environmental variables already set, most important being HOSTNAME.

Is there an easy way to override to become the URL we need it to be? Would changing this break some system that codespaces is reliant on?

I am sorry, but I am very new to github-codespaces, and using commands like export make it look like I fixed the problem, but when I docker-compose up I see that it is still using the old value.

HOSTNAME is not even listed in their default variables document, but every instance I have spun seems to have had it.

Any advice would be gratly appreciated!

Flotolk
  • 313
  • 1
  • 11
  • 37
  • `HOSTNAME` is typically set by the shell, and many other similar variables, not anything github related. `every instance I have spun` Probably you are typing your stuff in a shell, with shell environment around you. There are a lot of shell variables already set. – KamilCuk Jul 24 '23 at 15:03

1 Answers1

0

Yes, HOSTNAME is set by shell. you can run Dockerfile

FROM python:3.9-bullseye
WORKDIR /usr/src/app
COPY envprint.py ./
CMD [ "python3", "./envprint.py" ]

where envprint.py

import os

for k,v in os.environ.items():
    print (k,v)

After you bake image,you run it

docker run environ_image

expected output

PATH /usr/local/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
HOSTNAME 900p119ce123
LANG C.UTF-8
GPG_KEY *********************************
PYTHON_VERSION 3.9.17
PYTHON_PIP_VERSION 23.0.1
PYTHON_SETUPTOOLS_VERSION 58.1.0
PYTHON_GET_PIP_URL https://github.com/pypa/get-pip/raw/0d8570dc44796f4369b652222cf176b3db6ac70e/public/get-pip.py
PYTHON_GET_PIP_SHA256 96461deced5c2a487ddc65207ec5a9cffeca0d34e7af7ea1afc470ff0d746207
HOME /root
Richard Rublev
  • 7,718
  • 16
  • 77
  • 121