I install rstudio server on Docker. When I want to install package png, I got a wrong message that
`* installing *source* package ‘png’ ...
** package ‘png’ successfully unpacked and MD5 sums checked
** libs
gcc -std=gnu99 -I/usr/local/lib/R/include -DNDEBUG -I/usr/local/include
`libpng-config --cflags` -fpic -g -O2 -fstack-protector-strong -Wformat -
Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -g -c read.c -o
read.o
/bin/bash: libpng-config: command not found
read.c:3:17: fatal error: png.h: No such file or directory
#include <png.h>
^
compilation terminated.
/usr/local/lib/R/etc/Makeconf:132: recipe for target 'read.o' failed
make: *** [read.o] Error 1
ERROR: compilation failed for package ‘png’
* removing ‘/usr/local/lib/R/site-library/png’
Warning in install.packages :
installation of package ‘png’ had non-zero exit status`
I think maybe I should install a library named libpng-devel,but how to install it under docker?Would you please tell me? If it were a ubuntu or centos I know apt-get or yum,but under a docker,I am confused.
You need to identify the running container for Rstudio (e.g. docker ps), then use docker exec -it <container-id> to start a bash shell in that container. From the shell, you can install any system packages that are needed.
Adding to prusswan's answer above. Find out what your containers name is first on the command line with the Windows command:
docker -ps
This will give you the image id and the name if any. I'll use the id to open up a bash command line interface:
docker exec -ti d352815fb16b bash
Now we'll install the required linux library we need for png. In the bash shell type:
apt-get install libpng-dev
You should get a confirm prompt, type in y, and it will install. To exit out of the linux shell, type Cntl-D.
Now go back to your Rocker interface in your browser, and try to install png again:
install.packages('png')