LinuxQuestions.org
Review your favorite Linux distribution.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 11-16-2020, 05:15 AM   #1
burgas
LQ Newbie
 
Registered: Sep 2020
Posts: 22

Rep: Reputation: Disabled
How to attach Cdrom to docker 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.
 
Old 11-16-2020, 05:45 AM   #2
berndbausch
LQ Addict
 
Registered: Nov 2013
Location: Tokyo
Distribution: Mostly Ubuntu and Centos
Posts: 6,316

Rep: Reputation: 2002Reputation: 2002Reputation: 2002Reputation: 2002Reputation: 2002Reputation: 2002Reputation: 2002Reputation: 2002Reputation: 2002Reputation: 2002Reputation: 2002
Your docker run invocation creates a container based on image centos, and launches a command named cdrom:/media/cdrom in that container. This fails, since there is no command with this name.

To map /media/cdrom into the container, you can use -v /media/cdrom:MOUNTPOINT:ro, where MOUNTPOINT is the directory in the container. Not sure if the ro flag is required. See https://docs.docker.com/storage/bind-mounts/.
 
1 members found this post helpful.
Old 08-09-2021, 06:38 AM   #3
John07
LQ Newbie
 
Registered: Aug 2021
Posts: 2

Rep: Reputation: Disabled
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)
 
Old 09-08-2021, 02:33 AM   #4
John07
LQ Newbie
 
Registered: Aug 2021
Posts: 2

Rep: Reputation: Disabled
Quote:
Originally Posted by John07 View Post
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)
Can somebody confirm if my answer is correct or not?
 
Old 09-08-2021, 10:27 AM   #5
computersavvy
Senior Member
 
Registered: Aug 2016
Posts: 3,345

Rep: Reputation: 1484Reputation: 1484Reputation: 1484Reputation: 1484Reputation: 1484Reputation: 1484Reputation: 1484Reputation: 1484Reputation: 1484Reputation: 1484
Quote:
Originally Posted by John07 View Post
Can somebody confirm if my answer is correct or not?
Can you try it?

If you are not reasonably certain it is correct then it should not be posed as a solution.

I don't use docker so I have no idea.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
LXer: Meet Super Container OS, a Debian-Based Live Distro with a Built-In Container Engine LXer Syndicated Linux News 0 08-04-2020 11:24 AM
linux container host os and container os question jzoudavy Linux - Newbie 1 09-01-2015 05:21 AM
LXer: Inside the Open Container Project: How Docker plans to unite the container market LXer Syndicated Linux News 0 06-23-2015 04:30 AM
LXer: Tips and tricks: How do I use the "xm block-attach" command to attach additiona LXer Syndicated Linux News 0 08-21-2007 12:50 AM
libata detects cdrom but does not attach device zhangmaike Linux - Hardware 1 07-12-2006 01:22 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 01:29 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration