0

I have launched QuestDB through this way:

docker run -p 9000:9000 --memory="100g" --name docker_questdb -v questdb/questdb

After uncommenting the following line in the server.conf:

cairo.sql.copy.root=

Then running the import command:

COPY d1temp FROM '/home/user/d1_data/d1.csv'

would generate the following error:

QuestDB could not open file [errno=2, path=/home/user/d1_data/d1.csv] 

However, the file actually exists:

less /home/user/d1_data/d1.csv
s0,s1,s2
0.093684,0.601416,0.020954
0.181069,0.323754,0.624349
0.665080,0.735986,0.346020
0.317661,0.295168,0.540372
0.702641,0.381416,0.251456
0.056244,0.428558,0.985173
0.893521,0.018625,0.100640

Could this solved please? In the meantime, how could this be fixed?

AbdelKh
  • 499
  • 7
  • 19

1 Answers1

3

Os errno=2 is 'No such file or directory'. If path you specified is outside the container then you need to make sure it's shared via -v. It's best to enter the container and check that file exists inside (e.g. with docker exec) . Lastly - the path used in copy command is not absolute but relative to cairo.sql.copy.root so if cairo.sql.copy.root is set to '/home/user/d1_data/' then command should look like :

COPY d1temp FROM 'd1.csv'
  • Thanks @Bolek! I am using the -v command as my question states. The path is okay because cairo.sql.copy.root is set to an empty string so basically any absolute path should work. I was using it successfully with ./questdb start, but with the container it doesn't work. Should I then copy the file inside the container if I want to call it? Shouldn't the container have access to any absolute file on the disk? – AbdelKh Jun 24 '22 at 10:07
  • I think containers are rather isolated by default and can't access outside files that are not mounted or attached via volume . You have to either copy file inside container or (better option) share the path with container, e.g. docker run -p 9000:9000 --memory="100g" --name docker_questdb -v /home/user/d1_data/:/d1_data/ and then run copy as : COPY d1temp FROM '/d1_data/d1.csv' – Bolek Ziobrowski Jun 24 '22 at 11:46