How to attach Cdrom to container

I have mounted CDROM to my docker host

sudo mount /dev/cdrom /media/cdrom

then create volume

sudo docker volume create --name cdrom

and now I want to start container with my cdrom

sudo docker run -it centos cdrom:/media/cdrom

but receive
docker: Error response from daemon: OCI runtime create failed: container_linux.go:345: starting container process caused “exec: “cdrom:/media/cdrom”: stat cdrom:/media/cdrom: no such file or directory”: unknown.

What I doing wrong? Thanks.

I think this should work:

sudo docker run -v /media/cdrom:/media/cdrom -it centos

But maybe you need:

sudo docker run --device /dev/cdrom -it centos

You definitively don’t need a named volume (volume create)

Thank you, seimsel first one working if device is mounted

Perfect. I think the second one might work if the device is not mounted. You would need to mount it inside the container in that case.