Build C inside a container using VS Code as a web app, and GCC 13
10K+
After the image download, start as this:
docker run -d -p 8080:8080 -v ./workspace --name c-dev dbjdbj/dbj-devenv-gcc13
That creates and runs a container named "c-dev". Goto localhost:8080. That will be your vs code for C GCC-13 developments inside this container.
But where is your source? Straight answer: keep it on github.
basically mandates GCC or CLANG compilers. And C23 is the much preferred latest version. Not very Visual Studio, Windows-friendly situation. And recommended source of knowledge is https://gustedt.wordpress.com/.
This is mostly for Windows machines and developers. You use this container to develop code inside it. Nothing is required on a host WIN machine but Docker Desktop. http://localhost:8080 is how you reach VS Code inside it.
There is ssl_example non-trivial project inside to help you start.
WIN cmd script. Not mandatory but comfortable.
docker build -t c-devenv .
docker run -d -p 8080:8080 -v ./workspace --name c-dev c-devenv
echo.
echo Now you can open the workspace folder in Visual Studio Code
echo http://localhost:8080
echo.
Dockerfile, is what makes it possible. This is not making a minimal masterpiece docker file. Its purpose is to show you what is preferable when using containers for development.
FROM ubuntu:22.04
# Install required packages
RUN apt-get update && apt-get install -y \
build-essential \
gcc \
gdb \
make \
git \
wget \
curl \
ca-certificates \
apt-transport-https \
gnupg \
lsb-release
# Install VS Code server (code-server)
RUN curl -fsSL https://code-server.dev/install.sh | sh
# Set up working directory
WORKDIR /workspace
# Expose port for code-server
EXPOSE 8080
# Start code-server when container launches
CMD ["code-server", "--bind-addr", "0.0.0.0:8080", "--auth", "none", "/workspace"]
You of course know how to change the port to match your machine, if
8080is not available.As you know two files above are to be in the same directory
dbj.org CC BY SA 4.0
Content type
Image
Digest
sha256:0cb17e817…
Size
729.7 MB
Last updated
over 1 year ago
docker pull dbjdbj/dbj-devenv-gcc13