Unoconv call (openoffice) from other container - docker

I am new in linux and docker. I need to convert odt files to pdf from php container. I use php-5.6-apache and https://github.com/xiaojun207/openoffice4-daemon:
sudo docker build --pull
-t xiaojun207/openoffice4-daemon
–build-arg OO_VERSION=4.1.7 .
sudo docker run -d --restart unless-stopped
-u 123456
–name soffice
–net my-network
-p 8100:8100
-v /data/output-odt:/pdfs/:rw
xiaojun207/openoffice4-daemon:latest
sample of openoffice4-daemon works well from host:
sudo docker run
-v /var/output-odt:/pdfs:rw
xiaojun207/openoffice4-daemon
–net my-network
unoconv --connection ‘socket,host=127.0.0.1,port=8100,tcpNoDelay=1;urp;StarOffice.ComponentContext’
-f pdf /pdfs/test.odt
But I need to execute it from my php container. docker run is not possible from other container. How can I do it? Thanks

Related

can't control terminal after using the "-t" option in Docker

I am working through the Docker tutorial from here: https://docs.docker.com/language/python/develop/
I have done the first few steps from the tutorial to create a MYSQL container:
$ docker volume create mysql
$ docker volume create mysql_config
$ docker network create mysqlnet
$ docker run --rm -d -v mysql:/var/lib/mysql \
-v mysql_config:/etc/mysql -p 3307:3306 \
### (note: I used 3307:3306 here instead of the specified 3306:3306 because port 3306 was already being used on my machine) ###
--network mysqlnet \
--name mysqldb \
-e MYSQL_ROOT_PASSWORD=p#ssw0rd1 \
mysql
I then followed the next step to check if the mysql container was running:
$ docker exec -ti mysqldb mysql -u root -p
the terminal then prompts:
Enter password:
and I am unable to enter anything. no commands seem to work. ctrl+C didn't even register. the only thing I could do was kill the terminal itself. I am very confused since I have been following the documentation very closely though I am sure it's something very dumb.
Thanks in advance!
Try:
$ docker exec -ti mysqldb bash
then:
mysql -u root -p
I think you can connect with shell first

why do i keep seeing nginx index.html on localhost when i run my docker image

I installed and run nginx on my linux machine to understand the configurations etc. After a while i decided to remove it safely by following this thread in order to use it in docker
By following this documentaion i run this command
sudo docker run --name ngix -d -p 8080:80 pillalexakis/myrestapi:01
And i saw ngix's homepage at localhost
Then i deleted all ngix images & stopped all containers and i also run this command
sudo docker system prune -a
But now restarted my service by this command
sudo docker run -p 192.168.2.9:7777:8085 phillalexakis/myfirstapi:01 and i keep seeing at localhost ngix index.html
How can i totally remove it ?
Note: I'm new with docker and i might have missed a lot of things. Let me know what extra docker commands should i run in order provide better information.
Assuming your host have been preparing as below
your files (index.html, js, etc) under folder - /myhost/nginx/html
your nginx configuration - /myhost/nginx/nginx.conf
Solution
map your files (call volume) on the fly from outside docker image via docker cli
This is the command
docker run -it --rm -d -p 8080:80 --name web \
-v /myhost/nginx/html:/usr/share/nginx/html \
-v /myhost/nginx/nginx.conf:/etc/nginx/nginx.conf \
nginx
copy your files into docker image by build your own docker image via Dockerfile
This is your Dockerfile under /myhost/nginx
FROM nginx:latest
COPY ./html/index.html /usr/share/nginx/html/index.html
This is the command to build your docker image
cd /myhost/nginx
docker build -t pillalexakis/nginx .
This is the command to run your docker image
docker run -it --rm -d -p 8080:80 --name web \
pillalexakis/nginx

docker mediawiki localsettings with docker run

If I run mediawiki by docker run:
docker run --name wiki --link mysql -p 81:80 -d mediawiki
Where I have to put the LocalSettings.php file?
Thank you very much.
You mount the settings file from the host:
docker run --name wiki --link mysql -p 81:80 -v /path/on/your/computer/to/LocalSettings.php:/var/www/html/LocalSettings.php -d mediawiki

How to import CSV data to table through Docker container clickhouse-client

I'm using Docker for Windows:
Docker version 18.03.1-ce-win64
Docker Engine 18.03.1-ce
ClickHouse client version 1.1.54380
ClickHouse server version 1.1.54380
For exporting data from table into CSV format I am using the command:
Now run clickhouse-client container for export
$ docker run -it --rm --link clickhouse-server:clickhouse-client yandex/clickhouse-client -m --query="select * from default.table1 FORMAT CSV" > C:/Users/sony/Desktop/table1_data.csv --host clickhouse-server
NOTE: The above command works perfectly.
Now run clickhouse-client container for import
$ docker run -it --rm --link clickhouse-server:clickhouse-client yandex/clickhouse-client -m -c "cat C:/Users/sony/Desktop/table1_data.csv | clickhouse-client --host clickhouse-server --query='INSERT INTO default.table1 FORMAT CSV' "
Could you please tell me what I am doing wrong when importing?
Thanks in advance.
I think you should mount the csv file inside the container first. To mount the file you should add -v C:/Users/sony/Desktop/table1_data.csv :~/table1_data.csv option on your docker command. So your docker run command should be like this:
$ docker run -it --rm --link clickhouse-server:clickhouse-client yandex/clickhouse-client -m -v C:/Users/sony/Desktop/table1_data.csv:~/table1_data.csv -c "cat ~/table1_data.csv | clickhouse-client --host clickhouse-server --query='INSERT INTO default.table1 FORMAT CSV'"
Edit
My bad. Mounting inside the file wont work. Try this instead:
cat path_to_file/table1_data.csv | docker run -i --rm --link clickhouse-server:clickhouse-client yandex/clickhouse-client -m --host clickhouse-server --query="INSERT INTO default.table1 FORMAT CSV"
Already tried on linux, and it works. Since cat not works on Windows, I found type has same functionality, honestly haven't try it:
`type C:/Users/sony/Desktop/table1_data.csv | docker run -i --rm --link clickhouse-server:clickhouse-client yandex/clickhouse-client -m --host clickhouse-server --query="INSERT INTO default.table1 FORMAT CSV"`
Hope it works.

Docker port rewrite

I used docker for wordpress like this:
Create volume containers:
$ docker create -v /home/juanda/project/bbdd:/var/lib/mysql --name bbdd ubuntu /bin/true
$ docker create -v /home/juanda/project/web:/var/www/html --name web ubuntu /bin/true
Mysql container:
$ docker run --volumes-from bbdd --name mysql -e MYSQL_ROOT_PASSWORD="xxxx" -d mysql
Apache, php and wordpress container:
$ docker run --volumes-from web --name apache --link mysql:mysql -d -p 5555:80 wordpress
I installed and ran everything ok. If I remove apache container (stop and rm) and I launch it awain in another port (8080 instead of 5555), it rewrites url in navigator to 5555 and I get a connection error. Any idea?

Resources