Can't read from file issue in Swagger UI Docker image - docker

Based on question Can't read from file issue in Swagger UI
So what i need is disable validatorUrl but for docker image (swaggerapi/swagger-ui:v3.34.0) using environment variable. Is that possible?
I've tried to put swagger-config.yaml with content: validatorUrl: none into /usr/share/nginx/html inside docker image - it didn't help

Related

Add file to Docker Image

I am new to docker, and I have created a docker image for sparq spatial reasoning toolbox using pull docker pull dwolter/sparq:latest, (Gethub: https://github.com/dwolter/SparQ).
The sparq catains set of calculus in form of lisp files, which can be used to do spatial reasoning, using the Sparq docker image in the windows docker.
The thing that I have developed my own calculi and I need to add it to the image.
I have tried to do that using the cp command but I could not. Because I don't know the path of the file indside the image, in otherwords, where I should place the file inside the image, also when place it in the main root of a container, and applied the command commit, it generated error: access denied by ther resource.
first question is :
Does the path in the image has the same path in the sparq application folder which I have already downloaded?
Also, How I can add this culculi (lisp file) to the image in docker ?
P.s. I have also downloaded the folder which contains the application (sparq and all its files and folders) and I have placed my calculi inside the appropriate folder ( caculi folder and it works fine).
I run it using Linux command line and it works fine, Now I need to use this application through the docker.
As I have the application on folder.
Can I create an image on my own based on the folder that contains the application ?
The Sparq Dockerfile indicates the working directory is set to /root/sparq. That means, you should be able to run the following copy command in your own Dockerfile to place your lisp file in the same place you have locally, the place where all other Calculi lisp files are located:
FROM dwolter/sparq
COPY ./path/to/my/Calculi/file.lisp ./Calculi
Then run docker build . to build a Docker image containing sparq and your file. Then, it should be ready to run.
NOTE: I am not familiar with lisp. If it needs to be compiled, the compile command will need to be added to the Dockerfile after the COPY.

How to add Chromedriver to existing Docker?

I've personal ASP.NET Core project which scrapes data from the web using Selenium and Chromium and saves it in local sqlite database.
I want to be able to run this app in Docker image on my Synology NAS. Managed to create and run Docker image (on my Mac), it displays data from sqlite db correctly, but getting error when trying to scrape:
The chromedriver file does not exist in the current directory or in a directory on the PATH environment variable.
From my very limited understanding of Dockers in general, I understand that I need to add chromiumdriver inside the docker somehow.
I've searched a lot, went trough ~30 different examples and still can't get this to work.
Any help is appreciated!
You need to build a new image based on the existing one, in which you add the chromedriver binary. In other words you need to extend your current image.
So create a directory containing a Dockerfile and the chromedriver binary.
Your Dockerfile should look like this:
FROM your_existing_image_name:version
COPY chromedriver desired_path_inside_container
Then open a terminal inside this directory and execute:
docker build -t your_existing_image_name:version++ .
After that you should be able to start a container from the newly created image.
Some notes:
I have assumed that your existing image has been tagged with a version. If it is not the case then remove :version from Dockerfile
Similarly, remove :version++ from the build command. However, is a good practice to include versioning in your images.
I have not add any entrypoint assuming that you do not need to change the existing one.

How can I add an xml configuration file to a docker image via a Dockerfile?

I built a .jar file that accesses an .xml file
I add this jar file to docker via a Dockerfile
But how do I add this xml file to the docker image?
According to the Dockerfile best practices, the COPY command is preferred on the ADD command:
Although ADD and COPY are functionally similar, generally speaking, COPY is preferred.
recommended reading for your task:
The "ADD or COPY" section in the Dockerfile best practices.
Docker Tip #2: The Difference between COPY and ADD in a Dockerfile
ADD test-harness.xml test-harness.xml
This basically adds the .xml file to the Docker image and makes it accessible to the jar file which was added in a similar way.

What is the .dockerfile extension?

Visual Studio Code (1.22.2) offers a file extension named .dockerfile in the the save dialog. What is a file with this extension? A Dockerfile is in all documentation and examples, that I've seen so far, only called Dockerfile.
If I enter Dockerfile as a file name, a file named Dockerfile.dockerfile is created.
It appears that "*.dockerfile" is simply an alternative to the conventional "Dockerfile" name. This is perhaps useful if you want to keep a collection of dockerfiles in the same directory. Note the -f/--file option in docker help build:
-f, --file string Name of the Dockerfile (Default is 'PATH/Dockerfile')
In other words, you are not required to use the name "Dockerfile", and the VSCode extension will correctly syntax-highlight any file ending in ".dockerfile".
Dockerfile
A Dockerfile is a text document that contains all the commands a user could call on the command line to assemble an image. Using docker build users can create an automated build that executes several command-line instructions in succession. Docker images are the basis of containers. An Image is an ordered collection of root filesystem changes and the corresponding execution parameters for use within a container runtime. An image typically contains a union of layered filesystems stacked on top of each other. An image does not have state and it never changes.More on
Dockerfile extension
A Dockerfile has no extension . if your using docker on docker on windows use notepad ++ to create a dockerfile while saving select “All type “ and save the file name as “Dockerfile”.
Mongodb/Dockerfile
Using the .dockerfile extension tells VSCode that the file is a DockerFile for code highlighting and linting
What worked for me was to save the file in VS Code as a Dockerfile. But, you need to remove the .dockerfile extension that VS Code puts on it before running the $docker-compose up command:
Even though VSCode can deal with extensionless files just fine, some major parts of the Windows operating system can't. Try double clicking a Dockerfile (without extension) in the Windows Explorer. You will always be asked which program you want to open it in because Windows can't map extensionless files to a default program.
My guess is that because of this problem, Microsoft would like for all files to have an extension and uses VSCode to nudge people towards using a file extension for Dockerfiles, ignoring the fact that this contradicts the de facto standard.
Dockerfile doesn't have any extensions.
As you can see from hte documentation, https://docs.docker.com/compose/gettingstarted/, it doesn't have any extensions.

Configure Schemacrawler docker via configuration file?

Schemacrawler makes reference to a "configuration file", e.g. in https://www.schemacrawler.com/diagramming.html it says:
Show column ordinals, by setting configuration option schemacrawler.format.show_ordinal_numbers=true in the configuration file.
But I've not found what and where that file is.
I run Schemacrawler from its provided Docker images and struggle to make sense of where to configure e.g. schemacrawler.format.show_ordinal_numbers=true as referenced in the above docs.
Anyone know how this is intended to work?
(BTW I'm asking on SO because their repository suggests to do so)
Seems it makes use of this file: config/schemacrawler.config.properties.
From its Github repo I found these links:
Diagram Readme
Sample config file
Jon,
Please use the latest SchemaCrawler Docker image. When you open a shell in this Docker container, you will have a schemacrawler.config.properties file in the home directory. You can edit this file in vi, and then use it with SchemaCrawler by providing an additional -g ./schemacrawler.config.properties command-line switch. Instructions are provided on the Docker Hub SchemaCrawler page.
Sualeh Fatehi, SchemaCrawler

Resources