Reputation: 11
Im pretty new to docker, i've set up a few containers on my raspberry pi - They are running a website and i'd like to save user images. If i read correctly i need to mount a directory in my docker container "/world" to a volume i create.
I created the volume: docker volume create images_test
I attempted to link it using docker run:
docker run -it --privileged=true -d --network nginxnetwork --name=schedule-events-backend berthelmaster0802/schedule-events-backend -v images_test:/world uname -m armv7l;
My Dockerfile:
FROM mcr.microsoft.com/dotnet/core/sdk:3.1 AS build-env
WORKDIR /app
COPY *.csproj ./
RUN dotnet restore
COPY . ./
RUN dotnet publish -c Release -o out
FROM mcr.microsoft.com/dotnet/core/aspnet:3.1
WORKDIR /app
COPY --from=build-env /app/out .
ENTRYPOINT ["dotnet", "backend.dll"]
When i inspect my container:
docker inspect schedule-events-backend
"Mounts": [],
"Config": {
"Hostname": "8044b26c4ed7",
"Domainname": "",
"User": "",
"AttachStdin": false,
"AttachStdout": false,
"AttachStderr": false,
"Tty": true,
"OpenStdin": true,
"StdinOnce": false,
"Env": [
"PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin",
"ASPNETCORE_URLS=http://+:80",
"DOTNET_RUNNING_IN_CONTAINER=true"
],
My mount seems to be empty still. Anyone can figure out what im doing wrong?
Upvotes: 0
Views: 319
Reputation: 11
@DavidMaze solved the problem, thank you so much: "You've added the -v option after the image name, so it will be interpreted as the command to run and not a Docker option (you should see this in the docker inspect output too). Move the option before the image name"
Upvotes: 1