// Licensed to the Apache Software Foundation (ASF) under one or more
// contributor license agreements.  See the NOTICE file distributed with
// this work for additional information regarding copyright ownership.
// The ASF licenses this file to You under the Apache License, Version 2.0
// (the "License"); you may not use this file except in compliance with
// the License.  You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
= Installing Using Docker

== Running a Node

Run Ignite in a docker container using the `docker run` command. Docker will automatically pull the appropriate Ignite version:

[source,shell]
----
docker run -d -p 10300:10300 -p 10800:10800 -p 3344:3344 ignite/ignite3:latest
----

This command launches a single Ignite node. After you run the command, you can check if Ignite is running in the container logs.

== Running a Cluster

You can use the docker-compose file to start an entire cluster in docker. You can download a sample docker-compose file and run a 3-node cluster:

- Download the link:quick-start/docker-compose.yml[docker-compose] and link:quick-start/node-docker-config.conf[node configuration] that will be used by docker compose.
- Download the docker image:
+
[source,shell]
----
docker pull apacheignite/ignite:3.0.0
----
+
- Run the docker compose command. The node configuration should be in the same folder as docker compose file:
+
[source,shell]
----
docker compose -f packaging/docker/docker-compose.yml up -d
----

3 nodes will start in docker and will be available from CLI tool that can be run locally. Remember to initialise the cluster from the command line tool before working with it.

== Running CLI Tool in Docker

NOTE: It is not recommended to run the CLI tool in docker. Instead, we recommend to link:installation/installing-using-zip[download and install] CLI tool locally.

CLI tool is used to manage Ignite nodes.  By default, docker nodes are isolated and run on different networks, so CLI tool will not be able to connect to the target container from another container. To fix that, you need to create a network and add all containers running the nodes to it.

- Create a new network with the `network create` command:
+
----
docker network create ignite-network
----
+
- Add any containers with nodes that are already running to the network:
+
----
docker network connect ignite-network {container-id}
----
+
- Start the container with the Ignite CLI tool on the same network:
+
[source,shell]
----
docker run -p 10301:10300 -p 10801:10800 -p 3345:3344 -it --network=ignite-network ignite/ignite3:latest cli
----

The CLI will be able to connect to the IP address of the node. If you are not sure what the address is, use the `container inspect` command to check it:

----
docker container inspect {container-id}
----


