I am unable to change directory in jenkins. I am using docker jenkins/jenkins - jenkins-pipeline

Every time I try to change the directory it gives an error like this
enter image description here

Related

Docker image error: The origin server did not find a current representation for the target resource or is not willing to disclose that one exists

I created a docker image using a script. The docker image got created successfully but when I am trying to run on the browser, I get the following message
I tried to resolve the error using webapps but it is popping up the same message.
It is happening probably because the directory /usr/local/tomcat/webapps is empty. as you can see in the description in the Docker Hub official image:
You can then go to http://localhost:8888 or http://host-ip:8888 in a browser (noting that it will return a 404 since there are no webapps loaded by default).
To solve that, you can just create a new image and copy and paste what you want inside of the folder /usr/local/tomcat/webapps.
For example, you can find inside of the folder /usr/local/tomcat/webapps.dist files of the tomcat webapp manager. If you try to see what is that you can run:
$ docker run -it tomcat:10 ls /usr/local/tomcat/webapps.dist
ROOT docs examples host-manager manager
Now that you know what is inside of the folder /usr/local/tomcat/webapps.dist, create your own Dockerfile and copy and paste this folder to /usr/local/tomcat/webapps:
FROM tomcat
RUN cp -R /usr/local/tomcat/webapps.dist/* /usr/local/tomcat/webapps
CMD ["catalina.sh", "run"]
Build the image:
$ docker build . -t custom-tomcat
Execute the image:
$ docker run -d -P custom-tomcat
Check the port opened:
$ docker ps
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
58390eab3fec custom-tomcat "catalina.sh run" 9 minutes ago Up 9 minutes 0.0.0.0:49163->8080/tcp, :::49163->8080/tcp lucid_joliot
Open your browser and check if it works:

Mont a volume in host directoy

I am running an application with a dockerfile that I made.
I run at first my image with this command:
docker run -it -p 8501:8501 99aa9d3b7cc1
Everything works fine, but I was expecting to see a file in a specific folder of my directory of the app, which is an expected behaviour. But running with docker, seems like the application cannot write in my host directory.
Then I tried to mount a volume with this command
docker 99aa9d3b7cc1:/output .
I got this error docker: invalid reference format.
Which is the right way to persist the data that the application generates?
Use docker bind mounts.
e.g.
-v "$(pwd)"/volume:/output
The files created in /output in the container will be accessible in the volume folder relative to where the docker command has been run.

Running docker run command on windows

I am a beginner in docker and I am trying to run a Q&A website locally in my browser. I have found an open source container on the link https://hub.docker.com/r/zout84/askbot-docker. Here are the steps that I have done:
I have downloaded docker toolbox DockerToolbox-19.03.1.exe to be able to run docker using my Windows terminal.
Following the instructions on the above link I have run the command docker run -v /tmp/askbot:/data/ -p 8080:80 -d zout84/askbot-docker. Since I am on Windows I have replaced /tmp/askbot:/data/ by a folder I have created.
I have downloaded the container and put it a local folder that I called Docker_source. I have replaced zout84/askbot-docker by C:\Docker_source in the above docker run command
Now the error that I have is docker: invalid reference format: repository name must be lowercase.
Please, any suggestions on how to make it work?
Like the error said, The repository has to be lower case. It is called C:\Docker_source. You got a capital "D" over there. change it to a "d"

How to use ssh key inside docker container

I am building dockerfile to create an image where I want to build a package. I want to pull this package inside the docker image. I need to do a git clone for that. I saw the discussion on this post :
Using SSH keys inside docker container
Based on that, here is the content in my Dockerfile :
ENV SSH_HOME /Users/myid
ADD $SSH_HOME/.ssh/id_rsa /root/.ssh/id_rsa
RUN echo " IdentityFile ~/.ssh/id_rsa" >> /etc/ssh/ssh_config
When I run docker build, I am getting an error due to relative path. If I provide absolute path, it says the location is outside of context. Any idea how to fix this? I am running on Mac OSX 10.
With the script above, I am getting the following error :
ADD failed: stat /var/lib/docker/tmp/docker-builder6164655/Users/myid/.ssh/id_rsa: no such file or directory
Looks like it might be related to this bug here
The broken example is very similar to your path problem:
# Dockerfile
FROM ubuntu:14.04
COPY start.sh /start.sh
# comes back with:
stat /var/lib/docker/aufs/mnt/e89417ccaafbc91c3f930b56819427f83b3f2d3b3a246fbd6b48c9abcc7233f6/start.sh: no such file or directory
I'd try
updating to the most recent docker
restarting your docker engine

File is not created in Docker

I am new to Docker and trying to build Docker image. I simply created Docker file but getting some error not able to identify how to resolve this.
My Docker file code is:
FROM ubuntu
MAINTAINER ravat
RUN echo “Hello Apache server on Ubuntu Docker” > /home/ravata/Desktop/DockerDemo/index.html
CMD [ "/bin/bash" ]
the error I am getting is:
/bin/sh: 1: cannot create /home/ravata/Desktop/DockerDemo/index.html: Directory nonexistent
Not sure why are you trying to create the file at this specific location, but as error hints you, you need to create a folder you'd like to put your file first, e.g.
FROM ubuntu
MAINTAINER ravat
RUN mkdir -p /home/ravata/Desktop/DockerDemo/
RUN echo “Hello Apache server on Ubuntu Docker” > /home/ravata/Desktop/DockerDemo/index.html
CMD [ "/bin/bash" ]
Just to make it clear, the reason you do not have home folder for username ravata is the fact that no such user exists on brand new ubuntu docker image.
The error message tells you why, /home/ravata/Desktop/DockerDemo/ directory doesn't exists.
You should first create it.
Note that this file will be created inside your container, not on your computer. So directory should be created inside the container, for example with a RUN mkdir ...

Resources