I've used docker to install couchbase on my ubuntu machine using (https://hub.docker.com/r/couchbase/server/). The docker run query is as follows:
docker run -d --name db -p 8091-8094:8091-8094 -p 11210:11210 -v /home/dockercontent/couchbase:/opt/couchbase/var couchbase
Everything works perfectly fine. My application connects, I'm able to insert/update and query the couchbase. Now, I'm looking to debug a situation wherein the couchbase is on my co-developers machine who also has the same installation i.e., couchbase on docker using the above link. For achieving this, I wanted to run cbbackup on his installation. To achieve this, I run the following command which is a variation of the above link:
bash -c "clear && docker exec -it couch-db sh"
Can anyone please help me with the location of /opt/couchbase/bin in this setup? I believe this is where I can get access to "cbbackup", "cbrestore" and "cbtransfer" which I can then use to backup and restore data from my colleague's machine.
Thanks,
Abhi.
When you run the command
docker run -d --name db -p 8091-8094:8091-8094 -p 11210:11210 -v /home/dockercontent/couchbase:/opt/couchbase/var couchbase
you're pulling a docker image and spawning a docker container.
Please read more about Docker and containerization.
In order to run cbbackup you need to log into your docker container.
Follow these steps:
Retrieve the container-id:
$ docker ps -a
Look for the CONTAINER ID for IMAGE NAME=couchbase
Login to the container using the command:
$ docker exec -it <container-id> bash
Go to the directory : /opt/couchbase/bin using:
$ cd /opt/couchbase/bin
You'll find cbbackup binary in this directory.
Related
I'm trying to launch SQL Server for a technical test on my Macbook. Docker seemed to be best solution.
Tried using instructions from https://database.guide/how-to-install-sql-server-on-an-m1-mac-arm64/
Installed Docker okay.
Then tried to use:
sudo docker run --cap-add SYS_PTRACE -e 'ACCEPT_EULA=1' -e 'MSSQL_SA_PASSWORD=bigStrongPwd' -p 1433:1433 --name sqledge -d mcr.microsoft.com/azure-sql-edge
But when I tried to test the Docker using:
docker ps
The result was this:
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
What's gone wrong?
I did
docker run -v /jenkins_home:/var/jenkins_home jenkins/jenkins:alpine
on Windows (with docker installed as a linux container).
However, after configuring jenkins on that container, I now wanted to transfer the data in that /jenkins_home volume into a C:\jenkins_home folder on my local windows host machine\another machine.
Any way I can get the data from the /jenkins_home to c:/jenkins_home?
I know I should have made it
docker run -v c:/jenkins_home:/var/jenkins_home jenkins/jenkins:alpine
at the start but mistakes were made and I was wondering how do I fix that as the above suggestion?
Tried running
docker run -it -p 8080:8080 -p 50000:50000 --volumes-from jenkins_old -v c:/jenkins_home:/var/jenkins_home --name jenkins_new jenkins/jenkins:alpine
but it doesn't transfer the data over using the new c:\jenkins_home folder
docker run -v /jenkins_home:/var/jenkins_home jenkins/jenkins:alpine
Can't get the data to transfer over from the /jenkins_home folder to c:\jenkins_home folder.
I don't know where the /jenkins_home would map to on windows, but you could try this:
docker run -it --rm -v /jenkins_home:/from -v c:\jenkins_home:/to alpine cp -r /from /to
I have a jupyter notebook docker image from https://hub.docker.com/r/jupyter/datascience-notebook/.
Typically I run the notebook using this command
docker run -it --rm -p 8888:8888 -v /home/folder/Projects/:/home/jovyan/Projects -e NB_UID=1000 jupyter/datascience-notebook
This works perfectly and I am presented with the message that notebook is running. I am able to create notebooks, run them etc.
Now I want to install the jupyter contrib extenstions from https://github.com/ipython-contrib/jupyter_contrib_nbextensions. I followed the instructions here at: https://gist.github.com/glamp/74188691c91d52770807.
Using
docker run -it jupyter/datascience-notebook /bin/bash
command I am able to enter the container. Then I use pip and bash to install the package. All this goes smoothly.I exit the container and commit the changes using the container id.
docker commit containerid imagename
The problem is after committing the changes, when I run the container I am presented with bash prompt instead of the notebook start command.
Is there a way to commit package installation changes without changing the starting command of the image. Alternatively is there a way to edit the container image without actually running the image?
The problem is that you have committed a container that was started with the command /bin/bash.
What you need to is start the container normally using The command that you provided initially adding the -d option to free the terminal:
docker run -it --rm -d --name datascience-notebook -p 8888:8888 -v /home/folder/Projects/:/home/jovyan/Projects -e NB_UID=1000 jupyter/datascience-notebook
Then from the terminal exec into the container and install the contrib extenstions.
docker exec -it datascience-notebook /bin/bash
Exit the container and commit the image:
docker commit datascience-notebook <imagename>
Update:
In case the extension can't be installed when the container is running, the solution is to build a custom Docker image from using a Dockerfile
FROM jupyter/datascience-notebook
RUN <installation commands>
Finally build the image using docker build -t <image-name> . and run the image built.
I am using nodeBB to start a server you can run ./nodebb start to stop you can do ./nodebb stop. Now that I have dockerized it http://nodebb-francais.readthedocs.org/projects/nodebb/en/latest/installing/docker/nodebb-redis.html I am not sure how I can interact with it.
I have followed the steps "Using docker-machine mac os x"
docker run --name my-forum-redis -d -p 6379:6379 nodebb/docker:ubuntu-redis
Then
docker run --name my-forum-nodebb --link my-forum-redis:redis -p 80:80 -p 443:443 -p 4567:4567 -P -t -i nodebb/docker:ubuntu
Then
docker start my-forum-nodebb
I had an issue with redis address in use, so I want to fix that and restart but I am not sure how? Also I would like to issue the command grunt in the project directory, again not sure how?
My question is how can I interact with an app inside a docker container as if I had direct access to the project folder itself? Am I missing something?
All code in this answer is untested, as I'm currently at a computer without docker.
See whether the containers are still running
docker ps
Stop misconfigured containers
docker stop my-forum-redis
docker stop my-forum-nodebb
Remove misconfigured containers and their volumes
(The docker images they are based on will be retained.)
docker rm --volumes --force stop my-forum-nodebb
docker rm --volumes --force my-forum-redis
Start again
Then, issue your 3 commands again, now with the correct ports.
Execute arbitrary commands inside container
Also I would like to issue the command grunt in the project directory, again not sure how?
You probably want to do the following after the docker run --name my-forum-nodebb ... command but before docker start my-forum-nodebb.
docker run accepts a command to execute instead of the container's default command. Let's first use this to find out where in the container we'd land:
docker run my-forum-nodebb pwd
If that is the directory where you want to run grunt, just go forward with it:
docker run my-forum-nodebb grunt
If not, you'll have to stuff several commands into a single one. You can do that by invoking a shell:
docker run my-forum-nodebb bash -c 'cd /path/to/project/dir; grunt'
where /path/to/project/dir is to be replaced by where you want to run grunt.
I am running Boot2Docker v1.0.1 on Windows, and wish to fire up a Docker container I have created on a Google Compute Engine VM.
In order to do so, I need to save the container and upload it to Google Cloud Storage.
I issue the following command:
docker save --output=mycontainer.tar mycontainer:latest
The command completes without error. However, I cannot find the rce_env.tar file anywhere on my hard drive.
Does anyone have any experience with this? If not, is there a better way to run containers on GCE VM's?
You can run google/docker-registry locally to push your container images to GCS.
docker run -ti --name gcloud-config google/cloud-sdk \
gcloud auth login
docker run -ti --volumes-from gcloud-config google/cloud-sdk \
gcloud config set project <project>
docker run -d -e GCS_BUCKET=bucketname -p 5000:5000 \
--volumes-from gcloud-config google/docker-registry
docker tag imagename localhost:5000/imagename
docker push localhost:5000/imagename
And then run it on GCE to pull your containers from GCS.
docker run -d -e GCS_BUCKET=bucketname -p 5000:5000 google/docker-registry
docker run localhost:5000/imagename
I understand that you are using boot2docker on windows.
On a similar setup, using OSX and boot2docker 1.1.0, the following works:
docker save --output mycontainer.tar mycontainer:latest
As also does redirecting standard output:
docker save mycontainer:latest > mycontainer.tar
GCE now allows to store docker images for your projects using the gcloud command.
you can now run $ gcloud preview docker push gcr.io/YOUR-PROJECT/IMAGE-NAME
Source: https://cloud.google.com/tools/container-registry/#pushing_to_the_registry