Hi, the singlestore client you’re running within the container is mostly a slightly modified version of the mysql client, and expects similar arguments - since you setup a password, you need to specify it in the client: docker exec -it singlestore-ciab singlestore -p"$ROOT_PASSWORD"
If you’re curious about other options, you can check the help page with: docker exec -it singlestore-ciab singlestore --help
Since you setup port forwarding when initializing the container, you can also connect directly with mysql if you have it installed, without needing needing docker exec, for example: mysql -uroot -p$ROOT_PASSWORD
Thanks Rodrigo! I could login with client and have ensured that my text file is present and readable from /Users/arghyaroy/delete_me/books.txt. However, the Singlestore client is unable to read the location?
singlestore> CREATE PIPELINE library AS LOAD DATA FS ‘/Users/arghyaroy/delete_me/books.txt’ INTO TABLE classic_books FIELDS TERMINATED BY ‘,’;
ERROR 1933 (HY000): Cannot get source metadata for a pipeline. File or directory ‘/Users/arghyaroy/delete_me/books.txt’ does not exist
(base) Arghyas-MacBook-Pro:~ arghyaroy$ cat /Users/arghyaroy/delete_me/books.txt
The Catcher in the Rye, J.D. Salinger, 1945
Pride and Prejudice, Jane Austen, 1813
Of Mice and Men, John Steinbeck, 1937
Frankenstein, Mary Shelley, 1818
(base) Arghyas-MacBook-Pro:~ arghyaroy$
Hi, here’s a workaround that will help -
Since you’re using a Docker container to run the singlestore client, you’ll need to copy the text file inside the Docker container. The / address in your command refers to the root of your Docker container.
Try the following steps: mac_terminal> docker cp ‘/Users/arghyaroy/delete_me/books.txt’ 3048596335f9:/tmp
3048596335f9 is the ID of your Docker container.
singlestore> CREATE PIPELINE library AS LOAD DATA FS ‘/tmp/books.txt’ INTO TABLE classic_books FIELDS TERMINATED BY ‘,’;
singlestore> SELECT * FROM classic_books;
+------------------------+-----------------+------+
| book | author | year |
+------------------------+-----------------+------+
| The Catcher in the Rye | J.D. Salinger | 1945 |
| Pride and Prejudice | Jane Austen | 1813 |
| Of Mice and Men | John Steinbeck | 1937 |
| Frankenstein | Mary Shelley | 1818 |
+------------------------+-----------------+------+
4 rows in set (0.00 sec)
Let us know, if you face any issues with this solution.
There are a couple ways you can do this. The simplest way to do so is to use the dockerfile ADD command like so:
ADD . /path/inside/docker/container
However, any changes made to this directory on the host after building the dockerfile will not show up in the container. This is because when building a container, docker compresses the directory into a .tar and uploads that context into the container permanently.
The second way to do this is the way you attempted, which is to mount a volume. Due to trying to be as portable as possible you cannot map a host directory to a docker container directory within a dockerfile, because the host directory can change depending on which machine you are running on. To map a host directory to a docker container directory you need to use the -v flag when using docker run.