Friday 12 July 2024

Install and run ArangoDB using Docker

Step 1: Install Docker

If you don't already have Docker installed, you can download and install it from the Docker website.

 

Step 2: Pull the ArangoDB Docker Image

Open your terminal and pull the latest ArangoDB Docker image:

docker pull arangodb

 

Step 3: Run ArangoDB in a Docker Container

Once the image is pulled, you can run ArangoDB in a Docker container. The following command will run ArangoDB and map the necessary ports:

docker run -e ARANGO_ROOT_PASSWORD=mysecretpassword -d --name arangodb -p 8529:8529 arangodb

  • Replace mysecretpassword with your desired root password for ArangoDB.
  • The -d flag runs the container in detached mode.
  • The --name arangodb flag names the container arangodb.
  • The -p 8529:8529 flag maps port 8529 on your host to port 8529 in the container.

Step 4: Access ArangoDB

You can access the ArangoDB web interface at:

http://localhost:8529

 

Log in with the username root and the password you set in the ARANGO_ROOT_PASSWORD environment variable.

 

Step 5: Using ArangoDB Shell (arangosh)

To access the ArangoDB shell (arangosh) inside the Docker container, you can use the following command:

docker exec -it arangodb arangosh

This command will start an interactive shell session inside the running ArangoDB container.

 

Step 6: Managing the Container

  • To stop the ArangoDB container:

docker stop arangodb

  • To start the ArangoDB container again:

docker start arangodb

  • To remove the ArangoDB container:

docker rm arangodb

Optional: Persistent Data Storage

By default, the data stored in the container will be lost when the container is removed. To persist data, you can create a Docker volume:

 

docker volume create arangodb_data

 

Then run the container with the volume attached:

docker run -e ARANGO_ROOT_PASSWORD=mysecretpassword -d --name arangodb -p 8529:8529 -v arangodb_data:/var/lib/arangodb3 arangodb

 

This ensures that your data is stored persistently on your host system.

 

No comments:

Post a Comment