This is the first time I am using docker to run a release file.
I installed docker using
npm install -g docker
I am trying to use Prometheus.
https://github.com/prometheus/prometheus
I followed following steps
Download Prometheus [https://hub.docker.com/r/prom/prometheus/]
docker pull prom/prometheus
C:\xampp\htdocs\prometheus>docker pull prom/prometheus
Saved file tree to doc-filelist.js
Copied JS to doc-script.js
Compiled CSS to doc-style.css
Run docker [https://github.com/prometheus/prometheus]
docker run --name prometheus -d -p 127.0.0.1:9090:9090 prom/prometheus
C:\xampp\htdocs\prometheus>docker run --name prometheus -d -p 127.0.0.1:9090:9090 prom/prometheus
Saved file tree to doc-filelist.js
Copied JS to doc-script.js
Compiled CSS to doc-style.css
I am not sure what is wrong. Please advice
I think what you are installing is this docker which is a documentation generator rather than this docker , which is a container technology.
So , refer to this to install the correct Docker first .Then execute the following commands:
# docker pull prom/prometheus
# docker run --name prometheus -d -p 127.0.0.1:9090:9090 prom/prometheus
Then open the browser and visit http://127.0.0.1:9090 and you should see the Prometheus UI.
If you are using docker to run Prometheus, make sure
Docker engine is installed.
Keep a configuration file (promethues.yml) file.
run the container using the command.
docker run -d -p 9090:9090 -v /path_where_config_file_present/:/etc/prometheus -v /path_where_data_file_to_be_dumped/:/prometheus prom/prometheus:v2.4.0 --config.file=/etc/prometheus/prometheus.yml
Related
I am trying to use my nginx server on docker but I cannot use the files / folder if they belong to my volume. Problem, the goal of my test is to keep a volume between the file in my computer and the container.
I have searched during 3 days and tried a lot of solution but no effects...( useradd, chmod, chown, www_data, etc.....)
I don't understand how is it possible to use ngnix, a volume and docker?
The only solution actually for me is to copy the folder of my volume in another folder, and so I can chown the folder and use NGIX. There is no official solution on the web and I am surprised because for me using docker with a volume binded with his container would be the basic for a daily work.
If someone has managed to implement it, I would be very happy if you could share you code. I need to understand what I am missing.
FYI I am working with a VM.
Thanks !
I think you are not passing the right path in the volume option. There are a few ways to do it, you can pass the full path or you can use the $(pwd) if you are using a Linux machine. Let's say you are on /home/my-user/code/nginx/ and your HTML files are on html folder.
You can use:
$ docker run --name my-nginx -v /home/my-user/code/nginx/html/:/usr/share/nginx/html:ro -p 8080:80 -d nginx
or
$ docker run --name my-nginx -v ~/code/nginx/html/:/usr/share/nginx/html:ro -p 8080:80 -d nginx
or
$ docker run --name my-nginx -v $(pwd)/html/:/usr/share/nginx/html:ro -p 8080:80 -d nginx
I've created an index.html file inside the html folder, after the docker run, I was able to open it:
$ echo "hello world" >> html/index.html
$ docker run --name my-nginx -v $(pwd)/html/:/usr/share/nginx/html:ro -p 8080:80 -d nginx
$ curl localhost:8080
hello world
You can also create a Dockerfile, but you would need to use COPY command. I'll give a simple example that's working, but you should improve this by using a version and etc..
Dockerfile:
FROM nginx
COPY ./html /usr/share/nginx/html
...
$ docker build -t my-nginx:0.0.1 .
$ docker run -d -p 8080:80 my-nginx:0.0.1
$ curl localhost:8080
hello world
You can also use docker-compose. By the way, those examples are just to give you some idea of how it works.
I'm confused about what I should do to install Memgraph on Mac that has M1 processor. Do I need to run the command docker run -it -p 7687:7687 -p 3000:3000 memgraph/memgraph-platform or should I go to https://memgraph.com/download and download Docker image from that page?
Installing Memgraph on Linux, MacOS and Windows can be achieved by using Docker. There is a bit of difference if we talk about MemgraphDB and Memgraph platform.
If we talk about MemgraphDB there is no difference between downloading Memgraph from download website or pulling from Docker hub.
If you want to pull an image and build a container from the Docker hub, it is enough to run the docker command:
docker run -p 7687:7687 -p 7444:7444 -v mg_lib:/var/lib/memgraph memgraph/memgraph
This command will pull a MemgraphDB and run the container.
If you use our download page, then you need to load an image first with the following command:
docker load -i /path-to/memgraph-<version>-docker.tar.gz
After loading an image, you can build and run a container via the following command:
docker run -p 7687:7687 -p 7444:7444 -v mg_lib:/var/lib/memgraph memgraph/memgraph
If you want to install Memgraph platform (MemgraphDB, Lab, mgconsole, Mage), then only option is Docker hub, and running the following command:
docker run -it -p 7687:7687 -p 7444:7444 -p 3000:3000 -v mg_lib:/var/lib/memgraph memgraph/memgraph-platform
Previous command will pull the latest image, build the container and run it.
You can find a lot more information on MacOS installation docs
In addition, there are Linux native packages for Ubuntu, Debian and Centos 7,8.
I installed and run nginx on my linux machine to understand the configurations etc. After a while i decided to remove it safely by following this thread in order to use it in docker
By following this documentaion i run this command
sudo docker run --name ngix -d -p 8080:80 pillalexakis/myrestapi:01
And i saw ngix's homepage at localhost
Then i deleted all ngix images & stopped all containers and i also run this command
sudo docker system prune -a
But now restarted my service by this command
sudo docker run -p 192.168.2.9:7777:8085 phillalexakis/myfirstapi:01 and i keep seeing at localhost ngix index.html
How can i totally remove it ?
Note: I'm new with docker and i might have missed a lot of things. Let me know what extra docker commands should i run in order provide better information.
Assuming your host have been preparing as below
your files (index.html, js, etc) under folder - /myhost/nginx/html
your nginx configuration - /myhost/nginx/nginx.conf
Solution
map your files (call volume) on the fly from outside docker image via docker cli
This is the command
docker run -it --rm -d -p 8080:80 --name web \
-v /myhost/nginx/html:/usr/share/nginx/html \
-v /myhost/nginx/nginx.conf:/etc/nginx/nginx.conf \
nginx
copy your files into docker image by build your own docker image via Dockerfile
This is your Dockerfile under /myhost/nginx
FROM nginx:latest
COPY ./html/index.html /usr/share/nginx/html/index.html
This is the command to build your docker image
cd /myhost/nginx
docker build -t pillalexakis/nginx .
This is the command to run your docker image
docker run -it --rm -d -p 8080:80 --name web \
pillalexakis/nginx
My centos version and docker version(install by yum)
Use docker common error in container
My docker run command:
docker run -it -d -u root --name jenkins3 -v /var/run/docker.sock:/var/run/docker.sock -v $(which docker):/usr/bin/docker docker.io/jenkins/jenkins
but,its error when I exec docker info in jenkins container
/usr/bin/docker: 2: .: Can't open /etc/sysconfig/docker
Exposing the host's docker socket to your jenkins container will work with
-v /var/run/docker.sock:/var/run/docker.sock
but you will need to have the docker executable installed in your jenkins image via a Dockerfile.
It is likely the example you are looking at is already using a docker image. A quick google search brings up https://jpetazzo.github.io/2015/09/03/do-not-use-docker-in-docker-for-ci/ whose example uses a docker image (already has the executable installed):
docker run -v /var/run/docker.sock:/var/run/docker.sock \
-ti docker
Also note from that same post your exact issue with mounting the binary:
Former versions of this post advised to bind-mount the docker binary from the host to the container. This is not reliable anymore, because the Docker Engine is no longer distributed as (almost) static libraries.
I have this dockers commands
1 - docker run -itp 3000:3000 --expose 3000 --name ead-courses-service
-v /home/dizie/Projects/node/ead-project-api/ead-courses:/home/ead-courses
-w /home/ead-courses --link mongodb node-service npm start
2 - docker run -itp 3001:3001 --name ead-proofs-service -v
/home/dizie/Projects/node/ead-project-api/ead-proofs:/home/ead-proofs
-w /home/ead-proofs --link ead-courses-service,mongodb node-service npm start
3 - docker run -itp 3002:3002 --name ead-students-service -v
/home/dizie/Projects/node/ead-project-api/ead-students:/home/ead-students
-w /home/ead-students --link mongodb node-service npm start
I like to execute with mode easier.
Is possible?
Example, Dockerfile or docker-compose.
Not sure if this help. If you are using Windows then just create a .bat file and put all your commands in it. You just have execute this .bat file and all your command will get executed.
If you are using unix/linux OS then create a .sh file and put all your commands in it.
As these are plain commands these should help.
A first approach just to get you started woudl be to:
run those images (you get three containers)
docker commit those containers (you get three images representing what was running)
apply to those images CenturyLinkLabs/dockerfile-from-image, which will generate a Dockerfile per image.