Recreating containers from Mac OS to Rancher with .conf files

I’v started to migrate containers i have previously created under Docker for MAC OS.

By migrating I mean basically recreating containers using GUI as I do not know the way (at least in GUI) how I could just simply move it…

I succesfully created mariadb but having problem with php-fpm and nginx as the configuration of them is not as simply as GUI seems allowing to configure it,

For example my nginx looks like:
image: nginx:alpine
container_name: genesar-nginx-alpine
working_dir: /app
- ./app:/app
- ./phpdocker/nginx/nginx.conf:/etc/nginx/conf.d/default.conf
- "8090:80"
- php-fpm

and I have phpdocker/nginx/nginx.conf that looks like that:
server {
listen 80 default;

client_max_body_size 108M;
client_header_timeout	3000;
client_body_timeout		3000;
fastcgi_read_timeout	3000;

access_log /var/log/nginx/application.access.log;

root /app;
index index.html index.php;


if (!-e $request_filename) {
    rewrite ^.*$ /index.php last;

location ~ \.php$ {
    fastcgi_pass php-fpm:9000;
    fastcgi_index index.php;
    fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
    fastcgi_param PHP_VALUE "error_log=/var/log/nginx/application_php_errors.log";
    fastcgi_param REMOTE_ADDR "docker.for.mac.localhost";
    fastcgi_buffers 8 128k;
    fastcgi_buffer_size 128k;
    include fastcgi_params;



I do not see the possibility to add this .conf using Rancher GUI for container creation and how to place this file that container see it and use it…

There is something like command in GUI but I do not not how to use it and whether this is for what I need or just something different…

Would be happy to hear from you how to configure it…

You have a couple of options:

  1. Create your own Docker image based off of nginx, and then add your config file to the image. This works if you don’t need to change the config very often. When you need to change the config, you would need to create a new docker image.

  2. Create a secret using Rancher Secrets, and add the file to the container as a secret.

  3. Use an external volume, like rancher-nfs and put the file on the NFS server, and then mount the directory as a volume in the nginx container.

1 Like

Thank you, you pointed me in right direction…