This might be a problem due to using Docker Desktop, but I’m starting here because I don’t know.
Using Docker Desktop on Debian. I do not have the native docker engine installed on the laptop I’ve been working on.
I’m new to docker and as a learning project, have been trying to build an image/container to run steamcmd.
I’ve been trying to setup a bind mount, which I can use as an install target for downloaded game servers.
I can’t seem to get the bind mount to take. My first guess is that it revolves around the fact that I’m using Docker Desktop and the fact that it sounds like it runs in a VM on the host. Under the Resource settings → Virtual File Shares, I have “/home” and “/tmp/steam”. I had been trying to use a subfolder in my home directory to bind to, but all of the files seem to just end up in the container and not in the actual file system. Tried creating and adding the “/tmp/stream” folder as well, but haven’t seen any change.
Just looking for any insite into what I might be doing wrong or if it might just not be possible using Docker Desktop.
DOCKERFILE
FROM debian:bookworm-slim
LABEL Name=steamcmd Version=0.0.1
# Connection to the outside
RUN mkdir /output
VOLUME /output
# Setup the sources
RUN sed -i 's/^Components: main$/& contrib non-free non-free-firmware/' /etc/apt/sources.list.d/debian.sources
RUN dpkg --add-architecture i386
# Get the latest sources and perform any upgrades
RUN apt update
RUN apt upgrade -y
ENV DEBIAN_FRONTEND=noninteractive
# Install the dependencies
RUN apt install lib32gcc-s1 libcurl4 -y
# Accept the steam license agreement at the end of the install
RUN echo steam steam/question select "I AGREE" | debconf-set-selections
RUN echo steam steam/license note '' | debconf-set-selections
RUN apt install steamcmd -y
#Unset unneeded environment variables
ENV DEBIAN_FRONTEND=
# Get the latest steamcmd updates
RUN /usr/games/steamcmd +quit
COPY --chmod=744 ./execute.sh ~/execute.sh
ENTRYPOINT [ "~/execute.sh" ]
Image builds fine and runs execute.sh when it starts,. If I comment out the VOLUME command, no volume or bind shows in the inspect file. If I comment out mkdir and VOLUME command, I get an error that /output doesn’t exist. (more info below)
execute.sh
#!/bin/bash echo "Test" >> /output/test sleep 30 exit 0
It should create a test file, wait for 30 seconds, which allows me to look at the file system in Docker Desktop, then exit.
docker run:
docker run steamcmd --mount type=bind,source=/tmp/dockertest,target=/output
The test file is created in the container, but not in the host directory
In the inspect file, I do see a volume listed. If I comment out the VOLUME command from the dockerfile, this ends up emtpy.
"Mounts": [
{
"Type": "volume",
"Name": "072f2fdafc062e581d5d51eecde09adcf4fc30b850919941a433889f31fbc0a1",
"Source": "/var/lib/docker/volumes/072f2fdafc062e581d5d51eecde09adcf4fc30b850919941a433889f31fbc0a1/_data",
"Destination": "/output",
"Driver": "local",
"Mode": "",
"RW": true,
"Propagation": ""
}
],
The type should have been a bind, but it shows up as a volume. The path doesn’t exist on the actual host (no /var/lib/docker), so I’m assuming it is a link that only exists in Docker Destop’s virtual machine.