This question already has answers here:
How to show the run command of a docker container
(12 answers)
Closed 3 years ago.
I ran a docker run on a docker image with a long convoluted command syntax that I have since forgotton and lost. Is there any way to derive the syntax that ran a container given the container ID?
I know docker inspect can give you information about the container but I was hoping the docker run syntax would be saved somewhere.
As mentioned by Zeitounator, this was answered here, but just adding it here for completeness:
sudo docker run --rm -v /var/run/docker.sock:/var/run/docker.sock \
assaflavie/runlike <Your_Container_ID>
Related
This question already has an answer here:
Dashes in Docker commands
(1 answer)
Closed 1 year ago.
Learning docker so I have some dumb questions
Came across the below command , why is that some arguments have only one hyphen (-) while others have two hypens (--). One of them is not a argument? Like interactive terminal is -it , while remove container is with --rm ?
docker run -it --rm --entrypoint sh debug/ubuntu
What does --rm do in the above command. rm is to remove the container so why are they passing it when running the container?
Answered before here
This is a standard Unix/Linux syntax, not specific to docker. One dash
is used for single letter flags. Two dashes for an option that is more
than one letter. You can merge together multiple single letter options
that don't take arguments, e.g. -i and -t can be merged into -it. You
can run docker --help to see all the options, some of which have both
a long and short format.
The --rm means that the container will be removed automatically after it is stopped. Without --rm, it can be found "dangling" with docker container ls --all
This question already has answers here:
How to generate a Dockerfile from an image?
(11 answers)
Closed 1 year ago.
One of our X employee has created an docker image. Currently i need to update the same image which was created by him. But unfortunately i couldn't find the Dockerfile for the image.
Is it possible to generate a dockerfile from an image?
this answer is good from here
This worked for me from the answers
docker pull chenzj/dfimage
alias dfimage="docker run -v /var/run/docker.sock:/var/run/docker.sock --rm chenzj/dfimage"
dfimage image_id
you need the image id - not the name
e.g
$docker images
REPOSITORY TAG IMAGE ID CREATED SIZE
so the third column.
There is still work to do with it and it all depends how the docker image was created
You can try running this command:
alias dfimage="docker run -v /var/run/docker.sock:/var/run/docker.sock --rm alpine/dfimage"
dfimage -sV=1.36 IMAGE_NAME:IMAGE_TAG
And note at Dockerfile
This question already has answers here:
How to show the run command of a docker container
(12 answers)
Closed 1 year ago.
I have a container running in my ubuntu machine. I want to know the exact docker run command that was used to start that container. It is running since a long time and I don't remember what parameters were used to start that container.
You can find all the relevant run parameters for the container with:
sudo cat /var/lib/docker/containers/$(docker container inspect <container id> | jq -r .[0].Id)/config.v2.json | jq
This question already has answers here:
Explore Docker's image files if container exits immediately?
(3 answers)
Closed 3 years ago.
I downloaded an image which immediately stops. How can I inspect it (or any container spawned from it)?
I cannot use anything like docker exec -it CONTAINER_ID bash since I don't have time to get the CONTAINER_ID.
(docker run -it 5413e661e579 bash does not help, it starts the container and stops immediatly.)
I don't know how the image was built, I don't have the Dockerfile ; the only thing I know is the entrypoint: ["python" "app.py"] but it does not output anything useful.
Answer from duplicate question:
docker run -it --entrypoint "/bin/bash" image_name
You can get the container id by passing in the --all flag to docker container ls
docker container ls --all
This will list all containers, including those that have been stopped or exited. Then, once you have the container id, inspect the logs with the docker logs command
docker logs <container>
This question already has answers here:
Docker can't connect to docker daemon
(44 answers)
Closed 6 years ago.
I have started a docker container using the following command
vagrant#vagrant-ubuntu-trusty-64:~$ docker run -t -i ubuntu /bin/bash
root#abb8ef669ab6:/# cd
I am able to see the container shell. However, I am not able to list the docker processes in the new shell on the host using docker ps. am I missing something here?
vagrant#vagrant-ubuntu-trusty-64:~$ sudo usermod -aG docker vagrant
vagrant#vagrant-ubuntu-trusty-64:~$ docker ps -a
Cannot connect to the Docker daemon. Is the docker daemon running on this host?
I suppose here is the problem solution
"It is neccesary add user to docker group"
https://stackoverflow.com/a/33596140/2313177